Export to excel |
Well, I have the main query in the DB.
now I want only to export the return from the search. also, PHP excel does not work. This code exports me all the values whereas I need only the result from the search //Expor to Excel public function export_csv(){ $filename = 'expenses_'.date('Y-m-d').'.csv'; header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=$filename"); header("Content-Type: application/csv; "); $expenses_data = $this->expenses_model->export_expenses(); $file = fopen('php://output', 'w'); $header = array("Nr.", "Title", "Date", "Time", "User", "Amount", ); fputcsv($file, $header); foreach ($expenses_data as $key=>$line){ fputcsv($file,$line); } fclose($file); exit; } |
Messages In This Thread |
Export to excel - by Tajar_Dobro - 06-12-2021, 02:21 PM
RE: Export to excel - by InsiteFX - 06-12-2021, 08:57 PM
RE: Export to excel - by Tajar_Dobro - 06-13-2021, 02:36 AM
RE: Export to excel - by InsiteFX - 06-13-2021, 05:51 AM
RE: Export to excel - by demyr - 06-13-2021, 06:31 AM
RE: Export to excel - by Tajar_Dobro - 06-14-2021, 12:35 AM
RE: Export to excel - by paulkd - 06-16-2021, 05:12 AM
RE: Export to excel - by Tajar_Dobro - 06-18-2021, 04:42 AM
RE: Export to excel - by suvi - 06-16-2021, 03:41 AM
|