so I been getting this issue on my login page where its unable to find a variable I set but I have made sure its on the database. I have compared it with the databse and it all seems to match so I am not sure why im getting this error. Please find details below. Thank you for your help :)
Error : Notice: Undefined variable: ID in /home/scylla97/public_html/login.php on line 89
Code :
$SQLCheckLogin = $odb -> prepare("SELECT COUNT(*) FROM `users` WHERE `username` = :username AND `password` = :password");
$SQLCheckLogin -> execute(array(':username' => $username, ':password' => SHA1($password)));
$countLogin = $SQLCheckLogin -> fetchColumn(0);
if ($countLogin == 1)
{
$SQLGetInfo = $odb -> prepare("SELECT `access`, `username`, `ID`, `rank` FROM `users` WHERE `username` = :username AND `password` = :password");
$SQLGetInfo -> execute(array(':username' => $username, ':password' => SHA1($password)));
$userInfo = $SQLGetInfo -> fetch(PDO::FETCH_ASSOC);
if ($userInfo['access'] == 0)
{
$_SESSION['username'] = $userInfo['username'];
$_SESSION['ID'] = $userInfo['ID'];
{
$ip = getRealIpAddr();
if (filter_var($ip, FILTER_VALIDATE_IP))
{
$SQL = $odb -> prepare('INSERT INTO `logs` VALUES(:id ,:username, :loggedip, UNIX_TIMESTAMP())');
$SQL -> execute(array(':loggedip' => $ip, ':username' => $username, ':id' => $id));
echo '<div class="nNote nSuccess hideit"><p><font color=\'white\'><strong>SUCCESS: </strong>Login Successful. Redirecting....</font></p></div><meta http-equiv="refresh" content="3;url=index.php">';
die();
Line 89 is :
$SQL -> execute(array(':loggedip' => $ip, ':username' => $username, ':id' => $id));
I apologies in advanced if this is a stupid question and really easy to fix but I have spent the last few hours looking at it and playing around with it but still no fix.