php - How to create a csv file without the table elements inserted in the file -
i have code works fine prints out table elements. don't know how fix it. thanks
<?php // output headers file downloaded rather displayed header('content-type: text/csv; charset=utf-8'); header('content-disposition: attachment; filename=deferred_doc.csv'); // create file pointer connected output stream $output = fopen('php://output', 'w'); // output column headings fputcsv($output, array('app number', 'spoc assigned', 'borrower name', 'app_finish_date','developer & project', 'collateral address details' ,'original_deadline', 'deferred type','deferred_document','spoc remarks', 'juw-ma remarks', 'cosu remarks','file location','smu notes','date completed','submitted/pending','id')); // fetch data mysql_connect('xxxx', 'xxxx', 'xxx'); mysql_select_db('export_workflow'); $rows = mysql_query('select * collateral_management'); // loop on rows, outputting them while ($row = mysql_fetch_assoc($rows)) fputcsv($output, $row); ?>
the csv prints out table elements
i doing wrong code using my_sql, should have used my_sqli fetch data database
Comments
Post a Comment