我有这个代码完全正常,但它也打印出表格元素。我不知道如何解决它。感谢
<?php
// output headers so that the file is downloaded rather than displayed
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=deferred_doc.csv');
// create a file pointer connected to the output stream
$output = fopen('php://output', 'w');
// output the 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 the data
mysql_connect('xxxx', 'xxxx', 'xxx');
mysql_select_db('export_workflow');
$rows = mysql_query('SELECT * FROM COLLATERAL_MANAGEMENT');
// loop over the rows, outputting them
while ($row = mysql_fetch_assoc($rows)) fputcsv($output, $row);
?>
csv打印出像这个
这样的表格元素答案 0 :(得分:0)
我使用my_sql做了错误的代码,应该使用my_sqli从数据库中获取数据