[snip] I need do load data infile in mysql: $query_string2 = "LOAD DATA INFILE '/var/www/xls/test' REPLACE INTO TABLE `test` FIELDS TERMINATED BY ',' ENCLOSED BY '\"' ESCAPED BY '\\' LINES TERMINATED BY '\n'";$query_db_string2 = mysql_query($query_string2); But not realize nothing with execution the script. [/snip]
have you checked mysql_error() ?
yes, You have an error in your SQL syntax near ''' at line 2 but i change '\"' and not work.
The problem is PHP parses the string before it's passed to MySQL.
Since you're using double quotes
"ESCAPED BY '\\' LINES"
is parsed to
"ESCAPED BY '\' LINES"
by PHP and then sent to MySQL, which causes an error.
Two solutions:
'ESCAPED BY \'\\\' LINES' (use single quotes)
or
"ESCAPED BY '\\\\' LINES"
-- ---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php