[eluser]Unknown[/eluser]
See code below...
Code:
function query_events_older_than_timeperiod($value,$period)
{
$this->load->database('snortdb',TRUE);
$sql = "SELECT cid,sid,timestamp FROM event WHERE timestamp < NOW() - INTERVAL " . $value . " " . $period ." ORDER BY timestamp ASC";
$query = $this->db->query($sql);
$first_ev = $query->first_row('array');
$last_ev = $query->last_row('array');
$results = array('query' => $query,
'fe' => $first_ev['timestamp']);
return $results;
}
Everytime this function is executed I get the following error:
Quote:Fatal error: Allowed memory size of 18874368 bytes exhausted (tried to allocate 39 bytes) in /var/www/html/idscontrol/system/database/drivers/mysql/mysql_result.php on line 153
I have increased the memory allowed to scripts to 18M, but I do not think I should have to keep increasing it, that is not a solution.
If I remove the first_row() and last_row() calls, I get no errors. This query is returning ~45K rows.
Can anyone think of why asking for the first and last rows would cause this?