-2

我有这个代码

LOAD DATA INFILE '$filename' INTO TABLE选择列表FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';

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

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\wamp\www\dX\csvImport-picklist.php on line 20

我的 SQL 查询有什么问题?

4

1 回答 1

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
于 2012-09-26T00:23:51.677 回答