[eluser]Brad K Morse[/eluser]
I created a function that is suppose to export the data table as a csv file
I narrowed it down to $csv= this->data_model->exportCsv(); w/i the controller function export, I commented it out and the app returns to normal, but obviously does not work.
url for this export: domain.com/index.php/admin/export
Code:
// data_model function
function exportCsv() {
$this->load->dbutil();
$q = $this->db->order_by('first_name','asc')->get('data');
return $this->dbutil->csv_from_result($q, ",", "\n");
}
// admin controller function
function export() {
$this->load->dbutil();
$this->load->model('data_model');
$csv= this->data_model->exportCsv(); // this line of the code knocks out my entire ci app
$file_name = "list.csv";
force_download($file_name,$csv);
}
Any help as to what I am doing wrong is appreciated.