tengo un fichero .SQL que contiene la siguiente línea:
LOAD DATA INFILE 'mi.csv'
INTO TABLE myTable
FIELDS TERMINATED BY ';'
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
Pero me da el siguiente error:
Error: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''' at line 1 in C:\miPHP.php:3
Si quito FIELDS TERMINATED BY ';'
me da este otro error:
Error: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES' at line 1 in C:\miPHP.php:3
C:\miPHP.php:3
es prepare
:
$stmt = $pdo->prepare($query);
$stmt->execute();
1
del archivomiPHP.php
? Puede que el error esté en la forma de escribir la cadena de la consulta en PHP. Muestra ese código pulsando en editar.$query
en tu código.