Hoi,
Ik probeer met de volgende phpcode een (kommagescheiden) tekstbestand te importeren
<?php
$con=mysqli_connect($dbhost,$dbgebruiker,$dbww,$dbdb);
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$bestand=$_FILES['localfile']['tmp_name'];
$query="LOAD DATA LOCAL INFILE '$bestand' INTO TABLE `Boekingen` FIELDS TERMINATED BY ',' ENCLOSED BY '”' ESCAPED BY '\\' LINES TERMINATED BY '\r\n' IGNORE 1 LINES";
echo "Moment aub, bestand ".$bestand." word geimporteerd.<br><br>";
if (!mysqli_query($con,$query))
{
die('Error' . mysqli_error($con));
}
?>
Nu krijg ik de error
ErrorYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' IGNORE 1 LINES' at line 2
Maar doe ik dit rechtstreeks op de sql server dan geeft het geen probleem.
Groetjes,
Marco
1.922 views