Allowed memory size of 536870912 bytes exhausted (tried to allocate 117770705 bytes)
i am using codeigniter. im making a pivot table dashboard that will render millions of record.i have adjusted the memory_limit in php.ini to 1024M. and i have divided my query to prevent the memory buffered query error. this is my controller:
enter code here
$c = $this->stock_model->count_data();
$count = $c[0]["c"];
$from_id= 1;
$to_id=100000;
$data = '["BranchCode","rowid","BranchName","SBRDate", "ItemCode","ItemDesc","ItemPrice","ItemBalance","ItemAmount","ItemGroup","ItemCategory", "ItemLine"],';
while(intval($count) > 0){
$view_report = $this->stock_model->view_report($from_id, $to_id);
//var_dump($view_report);
foreach ($view_report as $key => $value) {
$data .= '["'.$value["BranchCode"].'",';
$data .= '"'.$value["rowid"].'",';
$data .= '"'.rtrim($value["BranchName"]).'",';
$data .= '"'.$value["SBRDate"].'",';
$data .= '"'.$value["ItemCode"].'",';
$data .= '"'.str_replace('"','\"',rtrim($value["ItemDesc"])).'",';
$data .= '"'.$value["ItemPrice"].'",';
$data .= '"'.$value["ItemBalance"].'",';
$data .= '"'.$value["ItemAmount"].'",';
$data .= '"'.rtrim($value["ItemGroup"]).'",';
$data .= '"'.rtrim($value["ItemCategory"]).'",';
$data .= '"'.rtrim($value["ItemLine"]).'"],';
}
file_put_contents("assets/textfile/test1.min.js","$.myArray = [".$data."];");
$from_id = intval($from_id) + 100000;
$to_id =intval($to_id) + 100000;
$count = intval($count) - 100000;
}
$this->load->view('stock_view');
my model is just a select query of all the records.
the script has successfully rendered but the pivot table is not showing. it's been loading for more than an hour now. there is no error showing. and im afraid he wont make it if the data increases. how can i render millions of rows in simplest way without reaching the limit even if the rows increased. Please help.