Re: [PHP-DB] Supplied argument is not a valid MySQL result From: Blaine Dinsmore (DinsmoreB <email protected>)
Date: 06/17/02

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 <email protected>> 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 

-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php