Hi,
I'm trying to set up a program to read a text file and import into MySQL. There are three pipe delimited fields.
This is the error message I get:
Database error: Invalid SQL: LOAD DATA LOCAL INFILE '/home/virtual/site2/fst/var/ INTO TABLE customer FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\' LINES TERMINATED BY '\r\n' ('email', 'first_name', 'last_name');
MySQL Error: 1064 (You have an error in your SQL syntax near '\r\n' ('email', 'first_name', 'last_name')' at line 1)
Session halted.
The SQL statement works fine in PHPMyAdmin. If it was me using this, I'd just use PHPMyAdmin, but it's not. So we need a web-based upload.
I've tried escaping the \r\n and just trying \n by itself.
It doesn't work. I'm baffled as to why it works in PHPMyAdmin and not a PHP program.
Thank you,
Jer
I'm trying to set up a program to read a text file and import into MySQL. There are three pipe delimited fields.
This is the error message I get:
Database error: Invalid SQL: LOAD DATA LOCAL INFILE '/home/virtual/site2/fst/var/ INTO TABLE customer FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\' LINES TERMINATED BY '\r\n' ('email', 'first_name', 'last_name');
MySQL Error: 1064 (You have an error in your SQL syntax near '\r\n' ('email', 'first_name', 'last_name')' at line 1)
Session halted.
The SQL statement works fine in PHPMyAdmin. If it was me using this, I'd just use PHPMyAdmin, but it's not. So we need a web-based upload.
I've tried escaping the \r\n and just trying \n by itself.
It doesn't work. I'm baffled as to why it works in PHPMyAdmin and not a PHP program.
Thank you,
Jer