Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/content/30/6567330/html/loser/template/session/usersession.phpm on line 148
I get this warning every time I want to use mysql_num_rows(). Code:
$result = mysql_query("SELECT id, logged_in, user_id FROM user_session WHERE ascii_session_id = '$id'",$this->dbhandle);
if(mysql_num_rows($result)>0) {
Numerous websites I’ve googled have similar if not exact calls. Why is this throwing the warining?
http://www.loserwars.com/template/session/sessiontest.php If You want to see the warnings. The Fatal error’d functions are not implemented yet. Is it the query itself? If so why doesn’t it throw the error? I’ve tried both forms:
for “select” queries mysql_query() returns a resource (result set) or FALSE if an error occurred.
Therefore, an alternative to “or die()” could be a more graceful error message for the user and a link back to the home page or whatever
$rs = mysql_query($query,$conn);
if(!rs) {
echo '<p>** Error - Server is busy. Please try again later</p>';
echo '<div><a href="index.php">Go to home page</a></div>';
die();
}