mysql table to .csv

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Anant
Forum Commoner
Posts: 66
Joined: Wed Jul 14, 2010 11:46 am

mysql table to .csv

Post by Anant »

Hi,

I have a situation where i need to convert the table fields to .csv txt file every time user clicks button on web page to get the latest list.

What would be the best way to achieve this ?


I tried this query -

Code: Select all

SELECT          *  
FROM            TABLE1 
INTO            OUTFILE 'path\file.csv' 
                FIELDS TERMINATED BY '\,' 
                OPTIONALLY ENCLOSED BY '\"'
                LINES TERMINATED BY '\n'
but not sure about the outfile path as i get error to provide password...

Thanks
Post Reply