问题
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