kjc
10-03-2002, 04:02 PM
I have created a web site in PHP and MySQL. Things work fine normally, but very occasionally it appears that a connection with the MySQL server cannot be made and as a result of the database driven information on the page does appear by instead I get the following dispalyed whenever information from the database is needed:
quote:
--------------------------------------------------------------------------------
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/u/s/username/public_html/browse_category.php on line 64
--------------------------------------------------------------------------------
Is there any reason why this is happenning. It is very infrequent. The mysql_num_rows checks to find out how many results from the query, so surely the error is because the query could no be run.?.
The code on each page is $conn=db_connect(); which then calls the following connection code from an external file:
quote:
--------------------------------------------------------------------------------
function db_connect()
{
$result= @mysql_pconnect("localhost", "username", "password");
if (!result)
return false;
if (!@mysql_select_db("username"))
return false;
return result;
}
--------------------------------------------------------------------------------
Any ideas?
quote:
--------------------------------------------------------------------------------
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/u/s/username/public_html/browse_category.php on line 64
--------------------------------------------------------------------------------
Is there any reason why this is happenning. It is very infrequent. The mysql_num_rows checks to find out how many results from the query, so surely the error is because the query could no be run.?.
The code on each page is $conn=db_connect(); which then calls the following connection code from an external file:
quote:
--------------------------------------------------------------------------------
function db_connect()
{
$result= @mysql_pconnect("localhost", "username", "password");
if (!result)
return false;
if (!@mysql_select_db("username"))
return false;
return result;
}
--------------------------------------------------------------------------------
Any ideas?