Supplied argument is not a valid MySQL result
| From: | Damiano Ferrari | Date: | Mon, 17 Jun 2002 17:00:39 +0000 |
| Subject: | Supplied argument is not a valid MySQL result | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-19848@lists.php.net to get a copy of this message | ||
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