Do: $query = "SELECT * from user where name='$userid' and pass=password('$password')"; echo $query. ".r\n"; See what the string looks like, and if you can replicate the problem by trying to execute that string in the mysql.exe command line tool. You ererror suggest that you have some kind of syntax error in your query. You can also test for an error directly after you have executed the query: if ($result) { $result = mysql_query($query, $link); $num_rows = mysql_num_rows($result); } else { // call mysql's error function } -----Original Message----- From: Arne Essa Madsen To: php-windows@xxxxxxxxxxxxx Sent: 31-10-2004 19:34 Subject: Problems with mysql_num-rows() I have the following problem: This one does not work: $query = "SELECT * from user where name='$userid' and pass=password('$password')"; $result = mysql_query($query, $link); $num_rows = mysql_num_rows($result); I get this error message: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\wamp\www\fs1812_new\authmain.php on line 18 This one works OK: $query = "SELECT * FROM user"; $result = mysql_query($query, $link); $num_rows = mysql_num_rows($result); What is wrong and how can I use mysql_num_rows when the query include "WHERE" A fast response will be very much appreciated. Arne Essa Madsen; arne@xxxxxxxxxxxxxxxxxx -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php