Dear All,
Please help and advice, i want to build an application with fgetcsv function (INSERT MySQL with csv file). The problem is the some of line in CSV file has an ENTER input, for example :
id|date_birth|name|notes
1|2009-03-12|dedi|sedang bersekolah di SDN pagi 1 Serpong
2|2009-03-01|budi|sedang bersekolah di SDN pagi
12 Serpong
3|2009-05-20|susi|sedang bersekolah di SDN pagi 1 Serpong
(tipe field : id = int
date_birth = date
name = char
notes = text
my function in code for fgetcsv :
while (($data = fgetcsv($handle, 5000, "|")) != FALSE) {
$import="INSERT into ticket_gtx(id,tgl_lahir,nama,keterangan) values('$data[0]','$data[1]','$data[2]','$data[3]')";
//print ("$import\n");
mysql_query($import) or die(mysql_error());
for field 1 and 3 succed to input to dbase, but in CSV file line 2 (red code) there are problem because some people using ENTER to input, so word "12 Serpong" cannot input to dbase
Please help me to solve this, because the source CSV file is cannot change or edit again
Regard,
Bernard