警告:mysql_num_rows rxpect参数1为资源

时间:2015-11-06 21:49:27

标签: php localhost login-page

<?php
require ('connect.php');
if (isset($_POST['submit'])){
$username=mysql_escape_string($_POST['uname']);
$password=mysql_escape_string($_POST['pass']);
if (!$_POST['uname'] | !$_POST['pass'])
 {
echo ("<SCRIPT LANGUAGE='JavaScript'>
        window.alert('You did not complete all of the required fields')
        window.location.href='loginn.html'
        </SCRIPT>");
exit();
     }
$sql= mysql_query("SELECT * FROM admin WHERE username ='$username' AND password ='$password'");
if(mysql_num_rows($sql) >0)
{
echo ("<SCRIPT LANGUAGE='JavaScript'>
        window.alert('Login Succesfully!.')
        window.location.href='loginn.html'
        </SCRIPT>");
exit();
}
else{
echo ("<SCRIPT LANGUAGE='JavaScript'>
        window.alert('Wrong username password combination.Please re-enter.')
        window.location.href='loginn.html'
        </SCRIPT>");
exit();
}
}
else{
}

?>

每当我尝试在google chrom上运行它时这个meassage(警告:mysql_num_rows rxpect参数1是资源)出现..我怎么能解决这个问题?

0 个答案:

没有答案