Re: mysql_num_rows
| From: | David Robley | Date: | Sat, 13 Apr 2002 11:42:23 +0000 |
| Subject: | Re: mysql_num_rows | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-18475@lists.php.net to get a copy of this message | ||
In article <20020413085630.70429.qmail@pb1.pair.com>, lukek@meibin.net
says...
> Hello All,
> I am struggling to understand why my query throws an error the code as below
>
> $link = mysql_connect ( "db.localhost.org", $user , $pass );
> if ( ! $link )
> die ( "Couldn't Connect to Mysql Server" );
> print "Sucessfully connect to server <p>";
> $query = "select * from users "
> ."where screen_name='$screen_name' "
> ." and passwd=password('$passwd')";
> $result = mysql_query($query, $link);
> if (mysql_num_rows($result) >0 )
>
> When executed you get a little message back like this one
>
> Warning: Supplied argument is not a valid MySQL result resource in
> /usr/local/share/doc/apache/trial/authmain.php on line 20
>
> What does this generally mean as I have noted that others use this syntax so
> what is my issue ?
>
> Any help or pointers to references would be most appreciated.
This generally means there is a problem with your SQL syntax; add to your
mysql_query line 'or exit(mysql_error()' and see waht you get.
mysql_error should return a descriptive error message from mysql.
--
David Robley
Temporary Kiwi!
Quod subigo farinam