PHP advice

From: Date: Sun, 24 Feb 2002 00:56:39 +0000
Subject: PHP advice
Groups: php.db 
Request: Send a blank email to php-db+get-17232@lists.php.net to get a copy of this message
I dont understand why this is causing me so much trouble, hopefully someone can help. I have a simple PHP script that takes the user id and password from a form on a page...here is the php used after submitting the form: <? @ $db = mysql_pconnect("localhost", "blah", "blah"); if (!$db) { echo "Error: Could not connect to database."; exit; } mysql_select_db("blahblah"); $query = "select * from auth where password = ".$password.""; $result = mysql_query($query); $num_results = mysql_num_rows($result); echo "Number of Rows: ".$num_results.""; mysql_close($db); ?> It connects fine, and when the query returns NO (0) rows, it appears correct. However, when the query returns a record, I get the following error: Warning: Supplied argument is not a valid MySQL result resource in picks.php on line 16 Where line 16 is the the line that says $num_results = mysql_num_rows($result); Does anyone have any advice? Appreciated in advance.. Greg _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com

« previous php.db (#17232) next »