Welcome! Log In Create A New Profile

Advanced

ASSIGNMENT 2 mysql_num_rows() ERROR

Posted by 46107894 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
ASSIGNMENT 2 mysql_num_rows() ERROR
March 18, 2012 03:22PM
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'winking smiley";
$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
avatar
Mac
Re: ASSIGNMENT 2 mysql_num_rows() ERROR
March 19, 2012 06:34AM
USE FORMATTED CODE TO PSOT CODE AS EXPALINED IN THE TUT LETTER! Do that and you may just receive an answer.
Sorry, you do not have permission to post/reply in this forum.