Page 1 of 1

N00b error

Posted: Wed Jan 26, 2005 3:41 pm
by dwfait
Hi. Taken a long time away from PHP..anyway..straight down to business.

$result=mysql_query("select user from sspp WHERE user='$user'");

if (mysql_num_rows($result)==0) {

With that code i get the error:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/stormst/public_html/registerc.php on line 16


Why is that? And what could i do to fix it?

Posted: Wed Jan 26, 2005 3:50 pm
by feyd
make sure the query is valid. (echo it out).. modify to

Code: Select all

$result = mysql_query(...) or die(mysql_error());

Posted: Wed Jan 26, 2005 4:20 pm
by dwfait
Thanks. I knew it was something newbish lol...i was trying to put it into a table that doesnt exist. I hate having to rush code...