> > Is it possible to create an excel file with some data from mySQL, using PHP
> > ?
> Yes if you know the file format for excel. If not then write your data into a 
> CSV file.

I just output the data as regular HTML (tabled, usually) but send the following
headers first:

  header("Content-Disposition: inline; filename=myfile.xls");
  header("Content-Description: PHP3 Generated Data");
  header("Content-type: application/vnd.ms-excel; name='excel'");

The browser will take that to mean that an excel document is coming through
and will open it up as such.  Since excel understands HTML, your data will be
displayed correctly.  Usually.
It's been working fine for us for years.


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to