mySQL加载数据INFILE - T_CONSTANT_ENCAPSED_String错误

时间:2012-09-26 00:21:52

标签: php mysql

我有这段代码

LOAD DATA INFILE '$filename' INTO TABLE {选取列表{1}}

但是当我执行它时,会显示以下错误:

FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';

我的SQL查询有什么问题?

1 个答案:

答案 0 :(得分:1)

可能你有一个没有转义的“(在附上),但没有看到更多就不可能说。

$sql = "LOAD DATA INFILE '$filename' INTO TABLE `picklist` FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n'";  // Added the escape character (slash) before the double quotes