Hi,
If anyone can look at the code below and identify why my variables do not work properly it would be much appreciated. All I'm trying to do is create a couple of variables so I can check them against each other
Bold text indicates problem:
If I run this code it works and I login:
if ($numrows != 0) // If numrows is either or equal to 0 - IE No data
{
while ($row = mysql_fetch_assoc($query)) // Fetches actual username and password
{
// $username = $row['$username'];
// $password = $row['$password'];
}
If ($username==$username && $password==$password) // Checks to see if matches
{
echo "You are logged in. <a href='clientscontrolpanel.php'>Click here to go to the Control Panel.</a>";
}
else
echo "Incorrect password";
}
else
echo "Username or Password not found!";
But if I run this I am not - Incorrect password echoed.
if ($numrows != 0) // If numrows is either or equal to 0 - IE No data
{
while ($row = mysql_fetch_assoc($query)) // Fetches actual username and password
{
$dbusername = $row['$username'];
$dbpassword = $row['$password'];
}
If ($username==$dbusername && $password==$dbpassword) // Checks to see if matches
{
echo "You are logged in. <a href='clientscontrolpanel.php'>Click here to go to the Control Panel.</a>";
}
else
echo "Incorrect password";
}
else
echo "Username or Password not found!";
Many thanks if you can shed some light on it. I'm guessing it is something to do with xampp configuration because this error seems so silly I can't be something like that can it ?