这是我的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

最佳答案

您需要在路径两边加引号

$sql = "
LOAD DATA INFILE '".$theFile."'
REPLACE INTO TABLE Product…

关于php - 无法使加载数据文件生效,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21007032/

10-12 22:08
查看更多