Bulk Exporting Data from Codeigniter to CSV using Database Utility Class

淺唱寂寞╮ 提交于 2019-12-06 09:37:44
// top of your controller
ini_set('max_execution_time', 0);

// Also you can increase memory
ini_set('memory_limit','2048M');

Download this helper and place in system/helpers/

and finally create csv like this

$this->db->select('*'); 
$query = $this->db->get('your_table');
$this->load->helper('csv');
query_to_csv($query, TRUE, 'filename.csv');

I think there is problem in max_execution_time of codeignator

You can increase it by using below code

Go to the file

system/core/CodeIgniter.php

Ans search for set_time_limit you find below code. Here you can increse your time

if (function_exists("set_time_limit") == TRUE AND @ini_get("safe_mode") == 0)
{
    @set_time_limit(300);// increase according to your requirmrnt
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!