Session Issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



can anyone help me with this problem, the code listed below should
return a username into the session variable instead it is returning
"1". I am not sure how this is happening, the only thing I can figure
it is returning the number of rows returned by the database. If anyone
could look this over and point me in the right direction that would be
great. Thanks to everyone in advance.

<?
$username = $_REQUEST["username"]; //varaible to hold username
$password = $_REQUEST["password"]; //variable to hold password

$DBconn = mysql_connect("****", "****", "****"); //Database connection
information

mysql_select_db("lpdb", $DBconn); //connection to the database

$sql = "SELECT user_name, pword from tbl_logins WHERE user_name =
'$username' and pword = '$password'"; //SQL query to search for the
username
$results = mysql_query($sql, $DBconn) or die(mysql_error()); //the
resulting data is outputted to $results variable

$num = mysql_num_rows($results); //the outputted data is enumerated
out into colums to be read in the HTML
if ($num !=0) {
	session_start();
	$session_register("loginusername");
	$_SESSION['loginusername'] = $username;
	header("Location: ../newlogin/username.php");
	} else {
	print "<h3> Unauthorized Login </h3> <br><br><a
href='../login.php'>Please Try Again</a>";
	exit;
}
?>


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux