Hello to all
I have a problem how to write correctly a PHP string.
I did the following import with the help of PHPMyAdmin:
Nombre d'enregistremen ts insérés : 364 (traitement: 0.0553
sec.)
requête SQL:
LOAD DATA LOCAL INFILE '/tmp/phpVfO8r8' INTO TABLE `fncid`
FIELDS TERMINATED BY ';' ENCLOSED BY '"' ESCAPED BY '\\'
LINES TERMINATED BY '\r\n'
I used this request in my PHP script like this:
$sql = "LOAD DATA LOCAL INFILE 'fncid.csv' INTO TABLE
'fncid' FIELDS TERMINATED BY ';' ENCLOSED BY '\"' ESCAPED
BY '\\\' LINES TERMINATED BY '\r\n'";
and get the following error:
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 ''fncid' FIELDS
TERMINATED BY ';' ENCLOSED BY '"' ESCAPED BY '\\' LINES
TERMINATE' at line 1
I tried to remove the '' for the table name:
$Sql = "LOAD DATA LOCAL INFILE 'fncid.csv' INTO TABLE fncid
FIELDS TERMINATED BY ';' ENCLOSED BY '\"' ESCAPED BY '\\\'
LINES TERMINATED BY '\r\n'";
mysql_query($sq l);
if(mysql_error( )) {
echo mysql_error() ."<br>\n";
}
and this time I get the following error message:
The used command is not allowed with this MySQL version.
I use this request bei the same Provider, same database and
same table as the PHPMyAdmin did it!
I think I don't write correctly the PHP string for this
request!
Could somebody help me.
Regards
Otto
I have a problem how to write correctly a PHP string.
I did the following import with the help of PHPMyAdmin:
Nombre d'enregistremen ts insérés : 364 (traitement: 0.0553
sec.)
requête SQL:
LOAD DATA LOCAL INFILE '/tmp/phpVfO8r8' INTO TABLE `fncid`
FIELDS TERMINATED BY ';' ENCLOSED BY '"' ESCAPED BY '\\'
LINES TERMINATED BY '\r\n'
I used this request in my PHP script like this:
$sql = "LOAD DATA LOCAL INFILE 'fncid.csv' INTO TABLE
'fncid' FIELDS TERMINATED BY ';' ENCLOSED BY '\"' ESCAPED
BY '\\\' LINES TERMINATED BY '\r\n'";
and get the following error:
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 ''fncid' FIELDS
TERMINATED BY ';' ENCLOSED BY '"' ESCAPED BY '\\' LINES
TERMINATE' at line 1
I tried to remove the '' for the table name:
$Sql = "LOAD DATA LOCAL INFILE 'fncid.csv' INTO TABLE fncid
FIELDS TERMINATED BY ';' ENCLOSED BY '\"' ESCAPED BY '\\\'
LINES TERMINATED BY '\r\n'";
mysql_query($sq l);
if(mysql_error( )) {
echo mysql_error() ."<br>\n";
}
and this time I get the following error message:
The used command is not allowed with this MySQL version.
I use this request bei the same Provider, same database and
same table as the PHPMyAdmin did it!
I think I don't write correctly the PHP string for this
request!
Could somebody help me.
Regards
Otto
Comment