Jump to content

mysql LOAD command


liltbobas

Recommended Posts

I'm trying to build a script to load tab delimited text files into my database, but I can't get a working query. Here's what I got:

$command = mysql_query ("LOAD DATA LOCAL INFILE '/file.txt' INTO TABLE electronics FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' (ITEM NUMBER, ITEM NAME, CATEGORY, SUB-CATEGORY, DESCRIPTION, WEIGHT, WHOLESALE PRICE, RETAIL PRICE, SHIPPING, HANDLING, CARRIER NAME, QUANTITY IN STOCK, IMAGE SMALL, IMAGE MEDIUM, IMAGE LARGE, DETAIL URL)");

if ($command) {

echo "<br>good";

} else {

echo "<br>bad";

}

It returns bad every time. Any suggestions? Thanks.
Link to comment
https://forums.phpfreaks.com/topic/3784-mysql-load-command/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.