Load Data local infile liest nur 0.00000 ein
HI,
aus unbekanntem Grund liest mir mein Load Befehl nicht die Werte aus der CSV in die Tabelle ein, sondern nur 0.00000.
Dabei sage ich dem SQL doch sogar mti dem @ als welches Format ich die Daten dort brauche... Wenn ich die CSV Datei durch den PHPMyAdmin importiere geht alles perfekt ;-( Jemand ne Idee?
aus unbekanntem Grund liest mir mein Load Befehl nicht die Werte aus der CSV in die Tabelle ein, sondern nur 0.00000.
<?php
define('HOST', '.....');
define('USER', '......');
define('PASS', '........');
define('DBNAME', '..........');
$connection = mysql_connect(HOST, USER, PASS);
if (!$connection) {
die("can not connect to the server!<br/>");
} else {
$rdb = mysql_select_db(DBNAME);
if (!$rdb) {
die("The " . DBNAME . "database could not be selected");
} else {
// insert to the student table query
$insert_query = "LOAD DATA LOCAL INFILE 'test.csv'
INTO table student4
FIELDS TERMINATED BY ';'
LINES TERMINATED BY '\n'
(Datum,Uhrzeit,Werteins,Wertzwei,Wertdrei, @date, @time, @decimal, @decimal, @decimal)
";
# NOT NULL muss hier noch irgendwo vermerkt werden....
if (!mysql_query($insert_query, $connection)) {
echo "Can't insert student record : " . mysql_error($connection);
} else {
echo "You have successfully insert records into student table";
}
}
}
mysql_close($connection);
?>
Dabei sage ich dem SQL doch sogar mti dem @ als welches Format ich die Daten dort brauche... Wenn ich die CSV Datei durch den PHPMyAdmin importiere geht alles perfekt ;-( Jemand ne Idee?
Please also mark the comments that contributed to the solution of the article
Content-Key: 275256
Url: https://administrator.de/contentid/275256
Printed on: April 23, 2024 at 09:04 o'clock