Cannot get Load Data Infile To Work

a 夏天 提交于 2019-12-25 05:33:12

问题


Here is my LOAD DATA script. I cannot get it to work. Any one have any heads up on what I can do? Thanks!

$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)";

Here is what and example of my txt file(s) looks like:

 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

Here is the error that I get:

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:


You need quotes around the path

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


来源:https://stackoverflow.com/questions/21007032/cannot-get-load-data-infile-to-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!