0

I´m trying to import a csv file and getting the error code

SQLSTATE[42000]: Syntax error or access violation: 1148 The used command is not allowed with this MySQL version

The funny thing is, that i´m using the same code for another table in the same database and it´s working. What i´m doing wrong?

try {
$pdo->exec("LOAD DATA LOCAL INFILE '$file' INTO TABLE example CHARACTER SET 'latin1' 
FIELDS TERMINATED BY ',' OPTIONALLY  ENCLOSED BY '\"' ESCAPED BY '\"'
LINES TERMINATED BY '\n' IGNORE 1 LINES (YEAR,MONTH,ARTIST_NAME,RELEASE_TITLE,BARCODE,ISRC,TRACK_TITLE,TRACK_VERSION,SHOP,TRANSACTION_TYPE,COUNTRY,QUANTITY,REVENUE)");
} catch(PDOException $e)
{
    echo $e->getMessage();
    echo "<br>";
}
LJSven
  • 147
  • 3
  • 13
  • 1
    Are you using the same CSV file for both tables? Are they structured correctly? Do all columns really exist? Have you checked your user's permissions? It might have different permissions on different tables. – Maru Jan 18 '16 at 15:18
  • Yes, the columns exist - it´s totally similar. When i upload the file on the database it works fine, but not when i use the php script – LJSven Jan 18 '16 at 15:57

0 Answers0