salut, je fais du php et j'ai une requête qui foire la voici :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
$query="LOAD DATA LOCAL INFILE 'C:/wamp/www/xlsmagique/liste/membre.csv' REPLACE INTO TABLE membre
FIELDS TERMINATED BY ';'
ESCAPED BY '\\'
LINES TERMINATED BY '\r\n' ";
$retour=mysql_query($query) or die(mysql_error());
l'erreur retournée est
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 ''' at line 4
le but est d'importer un fichier csv dans la table membre.
je ne trouve pas l'erreur dans la requête merci d'avance .

edit :
je rectifie la commande marche finalement mais en revanche
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
$chemin_fichier="C:/wamp/www/xlsmagique/liste/" . $nom_fichier; 									// Mise à jour des données
  $query="LOAD DATA LOCAL INFILE $chemin_fichier REPLACE INTO TABLE $nameTable
  FIELDS TERMINATED BY ';' 
  LINES TERMINATED BY '\n' ";
$retour=mysql_query($query) or die(mysql_error());
ca ne marche pas :
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 'C:/wamp/www/xlsmagique/liste/membre.csv REPLACE INTO TABLE membre FIELDS TERM' at line 1
c'est pourtant bien le bon chemin de fichier et la table membre