使用LOAD DATA INFILE时出错

时间:2014-05-27 19:57:13

标签: php mysql pdo

我想在我的PHP代码中使用LOAD DATA INFILE函数

代码:

$upload_article_query = "LOAD DATA INFILE 'ARTIKELS.CSV'
            INTO TABLE artikelen 
            FIELDS TERMINATED BY '|'
            LINES TERMINATED BY '\\r\\n'
            (a_lobecoid, a_code, a_omschint, a_beveiligingniv, a_type, a_assortiment, a_discipline, a_brutoprijs, a_status, a_levcode, a_omschr_nl, a_omschr_fr)
            SET a_id = NULL";

$upload_article_stmt = $dbh->prepare($upload_article_query);
$upload_article_stmt->execute();

但我一直收到错误:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry

我试着理解这个错误是什么意思,但似乎无法找到关于LOAD DATA INFILE的一个很好的解释。有人可以帮帮我吗?

0 个答案:

没有答案