Re: MySQL error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Wessley,

Friday, July 1, 2005, 10:55:16 AM, you wrote:

WR> $sql = "LOAD DATA LOCAL INFILE '/path/to/file.txt' INTO TABLE
WR> `mytable` FIELDS TERMINATED BY '\t' ESCAPED BY '\' LINES TERMINATED
WR> BY '\n'";
WR> mysql_query($sql) or die('<br><br>'.mysql_error());

WR> I get this MySQL error:
WR> You have an error in your SQL syntax. Check the manual that  
WR> corresponds to your MySQL server version for the right syntax to use
WR> near ''' at line 2

It looks to me like the \n (linefeed) character is actually being
turned into a line-feed character, because you've quoted the $sql
variable with " " - hence it's gone and turned \t into a tab, \n into
a line-feed, etc. I may be wrong, but I don't think MySQL likes this,
and given the error you are receiving it looks like that might be the
case. Quote it with ' ' to avoid translation of the \n and \t.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I do not fear computers. I fear the lack of them." - Isaac Asimov

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux