LOAD DATA INFILE给出错误代码1064

时间:2014-05-07 20:52:58

标签: mysql sql

我一直在尝试使用以下查询

$query_name = "LOAD DATA INFILE '"
            . $file_path . 
            "' INTO TABLE '"
            . $this->table_name . 
             "' FIELDS TERMINATED BY ',' 
             LINES TERMINATED BY '\\n' 
             IGNORE 1 LINES 
             (time_stamp,curr_property,curr_property_cost,day_property,day_property_cost,curr_solar_generating,curr_solar_export,day_solar_generated,day_solar_export,curr_chan1,curr_chan2,curr_chan3,day_chan1,day_chan2,day_chan3)";
                $this->db->query($query_name);  

将我的数据上传到数据库,但问题是我收到以下错误

    Error Number: 1064

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 ''admin_tmp' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' ' at line 1

LOAD DATA LOCAL INFILE 'uploads/admin.csv' INTO TABLE 'admin_tmp' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' IGNORE 1 LINES (time_stamp,curr_property,curr_property_cost,day_property,day_property_cost,curr_solar_generating,curr_solar_export,day_solar_generated,day_solar_export,curr_chan1,curr_chan2,curr_chan3,day_chan1,day_chan2,day_chan3)

我知道错误1064与语法有关但我没有看到我的代码有任何问题。如果有人能指出我的错误,会很高兴。

0 个答案:

没有答案