faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

42 of 60 people (70%) answered Yes
Recently 7 of 10 people (70%) answered Yes


Is there any way that i can show the content of a mysql DB into a excel file using php?

Feb 24th, 2008 00:09
dman, PHP Man, Matthew Gregory, Cesar Martinez, http://www.ttnr.org

There may be other ways of accomplishing this task, but the easiest by 
far is to simply dump the database contents into formally structured 
HTML tables.
Use the html_header() function to send the page mime type 
as "application/vnd.ms-excel".  This will tell the end-user's browser 
(Netscape or IE) that the incomming page should be treated as a 
Microsoft Excel doccument.  The browser will then pipe the page to the 
application and Excel will handle the rest.