Hi Guys
Am having constant issues with an error that I just cant get rid of.
The error is as follows: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in F:\My Documents\UNISA\ICT2613 PHP\EasyPHP-5.3.3\www\register.php on line 51
Below is a portion the code:
$catch = "SELECT * FROM coffees WHERE username = $userName";
$result = mysql_query($catch);
$num_rows = mysql_num_rows($result); //This row is line 51.
if ($num_rows > 0)
{
$errorMessage = "Username already taken";
print $errorMessage;
}
else
{
$insert = "INSERT INTO user (username, password) VALUES ('$userName', '$password1'
";
$result = mysql_query($insert);
}
I've tried everything but it just wont go away and it's affecting the outcome of the program.
Any suggestions would be most welcome