Re: load data infile -- problem
| From: | Dan Baker | Date: | Thu, 18 Aug 2005 17:15:52 +0000 |
| Subject: | Re: load data infile -- problem | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-40111@lists.php.net to get a copy of this message | ||
"select.now" <select.now@gmail.com> wrote in message
news:43047167.9060306@gmail.com...
> So, in command line, all works fine, all records are correctly imported.
> ---------------- <command line code> -------------------------
> >mysql load data infile 'c:\\datastream\\import\import
> ->into table iport
> -> fields terminated by ';'
> -> ignore 9 lines;
> ----------------- </command line code> ------------------------
> ------------------ <php code> -------------------
> $a = 'c:\\\datastream\\\import\\\import';
> $extra_arg = 'fields terminated by \';\' ignore 9 lines;';
> $query = 'load data infile \''.$a.'\' into table import
> '.$extra_arg.'';
> $result = mysql_query ($query) or die_mysql ("<br>Executia comenzii
> <i>$query</i> a esuat.<br>");
> ------------------ </php code> ----------------------
> I get this output-error:
> ===
> load data infile 'c:\\datastream\\import\\import' into table import
> fields terminated by ';' ignore 9 lines;
> ===
It looks like your slashes are a wee-bit messed up. Maybe try:
$a = 'c:\\datastream\\import\\import';
Note: a single '\' means to escape the next character, so two '\\' means to
put in a single '\'. You had three '\\\'.
DanB