Re: Supplied argument is not a valid MySQL result

From: Date: Mon, 17 Jun 2002 19:27:59 +0000
Subject: Re: Supplied argument is not a valid MySQL result
Groups: php.db 
Request: Send a blank email to php-db+get-19850@lists.php.net to get a copy of this message
Try this and see what happens. <? mysql_select_db(strtolower($username)) or die("Could not select database."); $query = mysql_query("SELECT * FROM users WHERE Password='$password'"); if (!$query) { echo (mysql_error()); exit(); } echo $matches = mysql_num_rows($query); ?> Blaine >>> Damiano Ferrari <damiano@webartonline.com> 06/17/02 01:00PM >>> Hi, Coming back after a weekend out of town, I noticed that the server of one of my clients was having problems with mySQL. All the scripts that were connecting to a db would return an error like the following: Supplied argument is not a valid MySQL result in (then the line of the script that failed) I then tried to check the db using phpMyAdmin (which was an older version, 2.2.0) and noticed that apparently all the databases were empty. I would also get errors when trying to create new db/tables. I then uploaded a newer version of phpMyAdmin (2.2.6) in another folder, and I could see all the tables and the information they contained, again. However, all the scripts that previously worked keep giving me the same error, that the supplied argument is not a valid MySQL result. A typical script that would cause this problem was like this: <? mysql_select_db(strtolower($username)) or die("Could not select database."); $query = mysql_query("SELECT * FROM users WHERE Password='$password'"); $matches = mysql_num_rows($query); ?> Similar scripts with different queries return an error at the same point, while trying to access the results returned by a query. I even tried replacing the above query with "SELECT COUNT(*) FROM users etc.", not to avail. What could have caused this problem? The server is running Windows NT, PHP is 4.1.0 and MySQL is 3.23. Any help would be greatly appreciated. Damiano -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.db (#19850) next »