Welcome Guest, Not a member yet? Register   Sign In
exporting query result to csv, one line of code knocking out entire app w/o error
#1

[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.


Messages In This Thread
exporting query result to csv, one line of code knocking out entire app w/o error - by El Forum - 11-17-2010, 09:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB