Jump to content

Archived

This topic is now archived and is closed to further replies.

zsxdcfv21

more simple question

Recommended Posts

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

130 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???

Share this post


Link to post
Share on other sites
There is an error in the query code or the query hasn't been called

Share this post


Link to post
Share on other sites
this is the other script where i could find the resultHasRows() function from the problem above

function 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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.