I’m doing some login authentication but for some reason I’m getting an error on my if statement. Here’s the code:
[php]<?php
if (isset($_POST[‘LoginSubmit’])) {
$Username = $_POST['logName'];
$Password = $_POST['logPass'];
$Hashed_Password = sha1($Password);
// 3. Perform database query to check login
$result_set = mysql_query("Select * FROM users WHERE userName = '$Username' AND hashed_password = '$Hashed_Password' LIMIT 1");
if (mysql_num_rows($result_set) == 1) {
// user authenticated
header("Location: http://localhost/CAServer/game.php");
} else {
// username/password combo not correct
echo "user not found.";
}
}
?>[/php]
the problem is with the line “if (mysql_num_rows($result_set) == 1) {”
I’m getting the error:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\CAserver\index.php on line 37
I’m not sure why I’m getting this error, any help you guys can provide would be great.
I marked the topic solved.