CodeIgniter Forums
A PHP Error was encountered - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: A PHP Error was encountered (/showthread.php?tid=24727)

Pages: 1 2


A PHP Error was encountered - El Forum - 11-19-2009

[eluser]John_Betong[/eluser]
[quote author="jiahui" date="1258713680"]Thank you for your patient.

I tried but got this error msg :

Quote:Fatal error: Call to undefined method CI_DB_mysql_driver::free_result() in C:\inetpub\sgcarmart\hoorfatt\system\application\models\usercontacts_model.php on line 10
[/quote]
 
Nicked from the User Guide:
Quote:$query->free_result()

It frees the memory associated with the result and deletes the result resource ID. Normally PHP frees its memory automatically at the end of script execution. However, if you are running a lot of queries in a particular script you might want to free the result after each query result has been generated in order to cut down on memory consumptions. Example:

$query = $this->db->query('SELECT title FROM my_table');

foreach ($query->result() as $row)
{
echo $row->title;
}
$query->free_result(); // The $query result object will no longer be available

$query2 = $this->db->query('SELECT name FROM some_table');

$row = $query2->row();
echo $row->name;
$query2->free_result(); // The $query2 result object will no longer be available