I have created a login pagefor users. It then submits the form and checks the authenticity of the details. However when I sign in it displays
Warning: mysql_num_row(): supplied argument is not a valid MySQL result resource in
Why is this happening? On my testing server it is displayed but when I upload it displays this message. Help!
Warning: mysql_num_row(): supplied argument is not a valid MySQL result resource in
Why is this happening? On my testing server it is displayed but when I upload it displays this message. Help!
Code:
<?php
// username and password sent from admin form
$Username=$_POST['Username'];
$Password=$_POST['Password'];
$sql="SELECT * FROM users WHERE Username='$Username' and Password='$Password'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $username and $password, table row must be 1 row
if($count==1){
// Register $username, $password and redirect to file "adminmenu.php"
session_register("Username");
session_register("Password");
header("location: adminmenu.php");
}
else {
echo "Wrong Username or Password";
}
?>