2 Replies - 844 Views - Last Post: 18 January 2008 - 11:44 PM Rate Topic: -----

#1 alecoder  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 50
  • Joined: 11-January 08

write mysql information in excel

Posted 18 January 2008 - 01:19 PM

hey all
then i want write mysql information in excel
for exemple
we have table
name lastname
jonh1 jonh1
jonh2 jonh2
jonh3 jonh3

and etc
i want write in php help all name's in excel document
help me
Is This A Good Question/Topic? 0
  • +

Replies To: write mysql information in excel

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4332
  • View blog
  • Posts: 12,127
  • Joined: 18-April 07

Re: write mysql information in excel

Posted 18 January 2008 - 02:44 PM

And of course I bet you want to be exportable so that someone can save the excel document it generates huh? If that is the case, you just need to do three things...

1) You need to set the "Content-Type" for the page to "application/vnd.ms-excel"
2) You need to add the header "Content-Disposition: inline; filename=nameoffilegoeshere.xls" (Do remember the rule about headers, send no data before you use header() or else you will get an error)
3) Write the content of the mysql records as you would an html table. The HTML and table cells will go straight into excel forming a table.

The rest should be cake.

Hope this has helped you. Enjoy!

"At DIC we be content exporting to excel code ninjas! Excel has nothing on us." :snap:

This post has been edited by Martyr2: 18 January 2008 - 02:45 PM

Was This Post Helpful? 0
  • +
  • -

#3 alecoder  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 50
  • Joined: 11-January 08

Re: write mysql information in excel

Posted 18 January 2008 - 11:44 PM

thx man ;)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1