load data infile -- problem

From: Date: Thu, 18 Aug 2005 11:30:47 +0000
Subject: load data infile -- problem
Groups: php.db 
Request: Send a blank email to php-db+get-40102@lists.php.net to get a copy of this message
Helo everyone ! I find this problem and I think I am close to the solution but ... The question: I need to import a few thousand of record storee in a *.csv file on my local harddisk, with my php application, managing my mysql engine. 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> ------------------------ But in my php app, because I am confuse a bit (use of ['], ["] and the definition of variables in mysql_query), I don't make this import. ------------------ <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; === and the import doesn't occured. Where is located my mistake ? Thanks in advance. -- cu respect, select.now@gmail.com

« previous php.db (#40102) next »