This topic is locked

Import csv file

6/26/2008 2:42:23 AM
PHPRunner General questions
R
rainerwolf author

Hi,
here is a solution to import data from a csv file: http://www.asprunner.com/forums/index.php?...5&hl=import, and it works great. Thanky to acpan.
My csvfile is comma seperated, but in the fields there are also commas. Now i want to enclose the fields with the following command:
$param = "LOAD DATA LOCAL INFILE '".$CSVFile."' IGNORE INTO TABLE schulen ";

$param .= "FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\\r\\n'";
In the event editor i've got an error about the right syntax at ENCLOSED BY '"'.

What must i do, to declare the sign " ?
Rainer

Sergey Kornilov admin 6/26/2008

$param = "LOAD DATA LOCAL INFILE '".$CSVFile."' IGNORE INTO TABLE schulen ";

$param .= "FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\\r\\n'";