简体   繁体   English

语法错误

[英]Getting error of Syntax

Here, I am importing data in mysql but getting error of syntax. 在这里,我正在mysql中导入数据,但是语法错误。

You have an error in your SQL syntax; 您的SQL语法有误; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IGNORE 1 LINES' at line 1 检查与您的MySQL服务器版本相对应的手册,以在第1行的“ IGNORE 1 LINES”附近使用正确的语法

My code: 我的代码:

$result = mysql_query("LOAD DATA INFILE 'D:\orderitems-100081669.txt' INTO TABLE tbl_order_details IGNORE 1 LINES FIELDS TERMINATED BY '\t' ENCLOSED BY '\"' LINES TERMINATED BY '\n' (@col1,@col3,@col4,@col7,@col8) set orderdet_id=@col1,orderdet_productid=@col3,orderdet_iscase=@col4,orderdet_qty=@col7,  orderdet_price_sold=@col8;")or die ('Error: '.mysql_error ());

You have placed the IGNORE 1 LINES at the wrong place. 您将IGNORE 1 LINES放置在错误的位置。

See the documentation . 请参阅文档

Try 尝试

LOAD DATA INFILE 'D:\orderitems-100081669.txt' 
INTO TABLE tbl_order_details 
FIELDS 
    TERMINATED BY '\t' 
    ENCLOSED BY '\"' 
LINES 
    TERMINATED BY '\n' 
IGNORE 1 LINES 
(@col1,@col3,@col4,@col7,@col8) 
SET orderdet_id=@col1,orderdet_productid=@col3,orderdet_iscase=@col4,orderdet_qty=@col7,  orderdet_price_sold=@col8;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM