0

Hi,

I am trying to save my query results into MS Excel format by using the following code.

It works on the 1st attempt, but however when i tried to save it again by making another query, i received this warning message: Cannot modify header information - headers already sent by (output started at C:\Program Files\EasyPHP5.3.0\www\phpexcel3.php:178) in C:\Program Files\EasyPHP5.3.0\www\phpexcel3.php on line 256

Can anyone able to advise me where is my mistake is? Cheers

my header script is :

header("Content-type: application/octet-stream");

# replace excelfile.xls with whatever you want the filename to default to
header("Content-Disposition: attachment; filename=excelfile.xls");
header("Pragma: no-cache");
header("Expires: 0");
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by network18
0

your script is echoing something before the headers are sent, and that's why you hit with this error.
Just echo something like "test" just above the headers you are trying to modify and you will see what is being echoed before your header, check source

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.