salut, je fais du php et j'ai une requête qui foire la voici :
l'erreur retournée est
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());
le but est d'importer un fichier csv dans la table membre.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
je ne trouve pas l'erreur dans la requête merci d'avance .
edit :
je rectifie la commande marche finalement mais en revanche
ca ne marche pas :
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());
c'est pourtant bien le bon chemin de fichier et la table membreYou 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
Partager