N00b error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dwfait
Forum Contributor
Posts: 113
Joined: Sun Aug 01, 2004 10:36 pm

N00b error

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

make sure the query is valid. (echo it out).. modify to

Code: Select all

$result = mysql_query(...) or die(mysql_error());
dwfait
Forum Contributor
Posts: 113
Joined: Sun Aug 01, 2004 10:36 pm

Post 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...
Post Reply