//define variable to check the number of rows where the sql query is true to find out if the username or password are already in use
$EmailCheck = mysql_query("SELECT `Email` FROM `Customer` WHERE `Email` = '$RegCusEmail'");
$UserCheck = mysql_query("SELECT `Username` FROM `Customer` WHERE `Username` = '$RegCusUser'");
//checks if emails in use
if (mysql_num_rows($EmailCheck) != 0)
{
echo '<p id="error">The Email address you have entered is already in use.<p>';
}
//checks if username is in use
elseif (mysql_num_rows($UserCheck) != 0)
{
echo '<p id="error">The username you have entered is already in use.<p>';
}
上面的代码应该在数据库中搜索注册人的电子邮件和用户名,如果它们已经存在,告诉用户使用不同的,但是当我使用它时,我得到了这个错误?
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in (file directory) on line 56 Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in (file directory) on line 62