zsxdcfv21 Posted August 30, 2006 Share Posted August 30, 2006 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/httpd/vhosts/mywebsitehere/httpdocs/lib.classes/class.MySQL.php on line 132130 function resultHasRows () 131 {132 $numRows = mysql_num_rows( $this->resultResource );133 if ( $numRows == 0 ) return false;134 return true; 135 }what are the possible things why it give out a warning??? Quote Link to comment Share on other sites More sharing options...
Barand Posted August 30, 2006 Share Posted August 30, 2006 There is an error in the query code or the query hasn't been called Quote Link to comment Share on other sites More sharing options...
zsxdcfv21 Posted August 30, 2006 Author Share Posted August 30, 2006 this is the other script where i could find the resultHasRows() function from the problem abovefunction trackUser() { global $db; if ( @ isset($_SESSION['EventID']) ) { // check for session expiry... $db->setQuery('SELECT EventID FROM SystemUsage WHERE LastPage < DATE_SUB(NOW(), INTERVAL 15 MINUTE) AND EventID = '. (int)$_SESSION['EventID']); $db->execute(); // expired! bad javascript no workie if ( $db->resultHasRows() ) { // set sessionedit $db->setQuery('UPDATE SystemUsage SET SessionEND = NOW() WHERE EventID = ' . (int)$_SESSION['EventID']); $db->execute(); // log them out! session_destroy(); header('Location: index.php?expired=1'); exit(); } // otherwise hit the last page! $db->setQuery('UPDATE SystemUsage SET LastPage = NOW() WHERE EventID = ' . (int)$_SESSION['EventID']); $db->execute(); } else { // or.. start a new tracking session... $UserAgent = $_SERVER['HTTP_USER_AGENT']; $RemoteAddr = $_SERVER['REMOTE_ADDR']; $db->setQuery('INSERT INTO SystemUsage (UserID, SessionStart, LastPage, UserAgent, RemoteAddr)'); $db->setQuery(" VALUES (" . (int)$_SESSION['UserID'] . ", NOW(), NOW(), '$UserAgent', '$RemoteAddr')"); $db->execute(); $db->setQuery('SELECT LAST_INSERT_ID() EventID'); $row = $db->executeOrDie(); $_SESSION['EventID'] = $row->EventID; }}wc part do you think has a problem? and if ever theres nothing wrong on that part, is there anyway that i could take out the warning message??? coz as soon as i view this link http://mywebsitehere/app/buyer.php?action=notes&BuyerID=1068, it has a warning message but it display the proper results :Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/httpd/vhosts/mywebsitehere/httpdocs/lib.classes/class.MySQL.php on line 132 Quote Link to comment Share on other sites More sharing options...
Barand Posted August 30, 2006 Share Posted August 30, 2006 Extra ')' at end$db->setQuery('SELECT EventID FROM SystemUsage WHERE LastPage < DATE_SUB(NOW(), INTERVAL 15 MINUTE) AND EventID = '. (int)$_SESSION['EventID'][color=red])[/color];Also, why the (int) cast when you want to concatenate strings? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.