I'm trying to create a user login script and I'm having trouble with a bit of the code. What I want to do is check all the rows in the table Users to see if the UserName column is $uzr AND the Password column is $password, here's what I've got:
$query = "SELECT * FROM Users WHERE UserName = $uzr AND Password = $password";
if (mysql_query($query)) {
SetCookie("User", "$uzr");
SetCookie("Password", "$password");
print ("Logged in. $uzr:$password");
} else {
print ("Username and password do not match up, Check your information and try again. $uzr:$password");
}
It keeps printing the else, even though I know the username and password match (I'm staring right at the information.)
Please help!