Page 1 of 1

mport csv files to Mysql with \r\n data

Posted: Tue Aug 23, 2005 3:59 pm
by kendall
Hello,

I am developing a restore/ update tables in a mysql database using data uploaded from a comma delimited format.

My question arises when i get errors pertaining to inserting the data back into mysql using mysql_query() because of "line breaks" in the data. i have tried converting these line breaks into their ascii character but i still get the error for it.

Can you guys recommend a method in dealing with a situation such as this?

Kendall
P.S. do you knwo of any snippet code librarys that allow me to parse the csv files based on its csv options i.e. fields terminated by, fields enclosed in, lines terminated by....etc

Posted: Tue Aug 23, 2005 4:28 pm
by infolock
nl2br might be what you are looking for.

import csv files to Mysql with \r\n data

Posted: Wed Aug 24, 2005 8:19 am
by kendall
infolock,

I was trying that but it is so hard to determine wether the new line is part of the data or an actual new row

Kendall

Posted: Wed Aug 24, 2005 8:22 am
by feyd
this thread may be of interest.