Cannot modify header information : Export CVS
Posted: Wed Sep 21, 2005 2:36 am
Can any folk see why the following might not work?
It's spitting :
Warning: Cannot modify header information - headers already sent by (output started at \www\collotype\materialsregister\template.inc:622) in \www\collotype\includes\functions.inc.php on line 140 (Which is the first Header Line).
TIA, Will
It's spitting :
Warning: Cannot modify header information - headers already sent by (output started at \www\collotype\materialsregister\template.inc:622) in \www\collotype\includes\functions.inc.php on line 140 (Which is the first Header Line).
TIA, Will
Code: Select all
function exportSAData () {
header("Content-type: application/octet-stream");
header("Content-disposition: attachment; filename=SMSRealty-Sales-Leads-".date("Y-m-d").".csv");
header("Pragma: no-cache");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");
// You do not need to change the function
$query = mysql_query("SELECT ausapapersummary.summaryId, aupapercategory.paperCategory, ausapapersummary.colloPaperName, ausapapersummary.manufacturerName, ausapapersummary.cpl, austock.stockDescription, auadhesive.adhesiveDescription, auliner.linerDescription, ausupplier.supplier FROM ausapapersummary LEFT JOIN aupapercategory ON ausapapersummary.paperCategoryId = aupapercategory.papercategoryId LEFT JOIN austock ON ausapapersummary.stockId = austock.StockId LEFT JOIN auadhesive ON ausapapersummary.adhesiveId = auadhesive.adhesiveId LEFT JOIN auliner ON ausapapersummary.linerId = auliner.linerId LEFT JOIN ausupplier ON ausapapersummary.supplierId = ausupplier.supplierId WHERE 1=1");
$row = mysql_fetch_array($query);
print "$header\n$row";
}