无法使负载数据Infile工作

时间:2014-01-08 21:35:05

标签: php mysql csv load-data-infile

这是我的LOAD DATA脚本。我无法让它发挥作用。任何人都对我能做什么有所了解?谢谢!

$sql = "
LOAD DATA INFILE ".$theFile."
REPLACE INTO TABLE Product
FIELDS TERMINATED BY '|'
LINES TERMINATED BY '\n'
(archived_id_number, sku, name, upc, account_id, shippingBox_id, unit_cost, supplier_id, description, productLength, productWidth, productHeight)";

以下是我的txt文件的示例和示例:

 43485|7850|Cool Circuits|630227078508|74||10.00|545||0.00|0.00|0.00
 39682|7802|Light|630227078027|74||10.00|545||0.00|0.00|0.00

这是我得到的错误:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/home/hallow8/public_html/xxxx/scripts/productsNew2/data_science_wiz.txt' at line 1

1 个答案:

答案 0 :(得分:0)

你需要在路径

附近引用
$sql = "
LOAD DATA INFILE '".$theFile."'
REPLACE INTO TABLE Product…