MySQL - SELECT ... INTO OUTFILE
Posted: Wed Jul 16, 2008 4:25 am
hi there.
i have a little php script that every day generates a .csv file using this mysql query,
[sql] SELECT * FROM `content` WHERE `status` < '6' AND `status` > '0' AND `date_status` BETWEEN '$startDate' AND '$endDate' INTO OUTFILE 'C:/temp/csvFiles/$csvfile' FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\n' [/sql]
everything is working good except that i have a field `info` where i can write everythink that i want related with a specific status, but if i insert a new line and then i go see the content of the csv file, i notice that it creates a new line in the file where isnt supose to be. i know that in mysql i can use FIELDS ESCAPED BY but i've already try that without sucess, maybe i'm doing something wrong. another way is to do something that i've read in the last coment in this page ( http://dev.mysql.com/doc/refman/5.0/en/select.html ).
same problem: http://lists.mysql.com/mysql/212786
i hope that you can understand what i'm saying, any help will be appreciated.
thanks in advance
i have a little php script that every day generates a .csv file using this mysql query,
[sql] SELECT * FROM `content` WHERE `status` < '6' AND `status` > '0' AND `date_status` BETWEEN '$startDate' AND '$endDate' INTO OUTFILE 'C:/temp/csvFiles/$csvfile' FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\n' [/sql]
everything is working good except that i have a field `info` where i can write everythink that i want related with a specific status, but if i insert a new line and then i go see the content of the csv file, i notice that it creates a new line in the file where isnt supose to be. i know that in mysql i can use FIELDS ESCAPED BY but i've already try that without sucess, maybe i'm doing something wrong. another way is to do something that i've read in the last coment in this page ( http://dev.mysql.com/doc/refman/5.0/en/select.html ).
same problem: http://lists.mysql.com/mysql/212786
i hope that you can understand what i'm saying, any help will be appreciated.
thanks in advance