Bonjour les amis,

J'essai d'utiliser LOAD DATA INFILE de SQL.

Pouvez vous me dire ce qui cloche dans ma requête suivante

Code php : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
 
$escap="\\";
$terminatedField=";";
$enclosed='"';
$terminatedFile="\n";
$start="";
$mon_file="monfile.csv";
 
 
$ReqInsertGraph="LOAD DATA INFILE \"".$mon_file."\" INTO TABLE table_tampon FIELDS TERMINATED BY \"".$terminatedField."\"
ENCLOSED BY \"".$enclosed."\" ESCAPED BY \"".$escap."\" LINES STARTING BY \"".$start."\" TERMINATED BY \"".$terminatedFile."\" (champ1, champ2, champ3, ....., champn)";
 
 
$bdd->query($ReqInsertGraph);
print_r($bdd->errorInfo()); echo "<br>";//afficher l'erreur correspondante

j'ai cette erreur à l'éxecution :

Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
Array ( [0] => 42000 [1] => 1064 [2] => 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 '\" LINES STARTING BY "" TERMINATED BY " "


Merci d'avance