phpbar.de logo

Mailinglisten-Archive

[php] load data local infile

[php] load data local infile

Bernd Schulz php_(at)_phpcenter.de
Thu, 5 Sep 2002 15:05:08 +0100


Hallo,
moechte Daten asu einer txt-Datei vom Client aus in eine MYSQL-DB laden.

<?
if (!isset($step))
{
?>
<html>
<body>
<form action="test.php3" ENCTYPE="multipart/form-data" method="post">
Die Datei auswaehlen&nbsp;&nbsp;<INPUT NAME="textfile" TYPE="file">
<br><br>
<input type="SUBMIT" name="step" value="Speichern">
</form>
</body>
</html>
<?
} else {
$pfad="/homepages/28/d..../htdocs/kvhs";
copy ( $textfile, $pfad. "/".$textfile_name );
require("../sql.inc.php3");
$textfile=$pfad."/".$textfile_name;
$tab="vhs_saw";
$term="\t";
if(!mysql_query("LOAD DATA LOCAL INFILE '$textfile' into table '$tab' fields
terminated by '$term'"))
echo mysql_error();
}
?>

Die Datei wird richtig auf den Server uebertragen, jedoch nicht in die DB.
Die Fehlermeldung:
You have an error in your SQL syntax near ''vhs_saw' fields terminated by ' ''
at line 1

Was ist hier noch falsch?

Danke Bernd


php::bar PHP Wiki   -   Listenarchive