Page 1 of 1

how to picks the data from database and put into csv file

Posted: Tue Jul 22, 2008 2:06 am
by manohar
I want to download csv file containing states.All states are available in the states table
Any one can pls help me

Re: how to picks the data from database and put into csv file

Posted: Tue Jul 22, 2008 3:10 am
by Kadanis
There are 2 ways I can think of to do this.

Either you connect to the database, iterate over the table and output it to a page. Make sure you set the page content type to csv and as a download and you should be fine. Or, you could use the MySQL OUTFILE command.

Code: Select all

 
SELECT * INTO OUTFILE ...
 

Google is your friend

http://www.ineedtutorials.com/articles/ ... p-tutorial