I am new to php and am having some trouble with my code. Please help.
if (mysql_num_rows($login) == 1) {
while($row = mysql_fetch_array($sql)){
// Get member ID into a session variable
$id = $row[“id”];
session_register(‘id’);
$_SESSION[‘id’] = $id;
// Get member username into a session variable
$username = $row[“username”];
session_register(‘username’);
$_SESSION[‘username’] = $username;
$_SESSION[‘position’] = $row[‘access’];
if(isset($_SESSION[‘position’] == 2)
{
header(‘Location: admin.php’);
}
else {
// Update last_log_date field for this member now
// Print success message here if all went well then exit the script
header(‘Location: securedpage.php’);
exit();}
} // close while
} else {
// Print login failure message to the user and link them back to your login page
header(‘Location: loginfail.html’);
exit();
}
}