List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:March 14 2003 5:59pm
Subject:Re: LOAD DATA FILE
View as plain text  
At 19:58 +0300 3/14/03, nadusha@stripped wrote:
>I have strange problem with LOAD DATA INFILE
>
>$file="base.txt";
>$conn=mysql_connect('localhost', 'user', 'paswd');
>mysql_select_db('realestate', $conn);
>$query="LOAD DATA INFILE '".$file."' REPLACE INTO TABLE
>table_name FIELDS TERMINATED BY '\t' LINES TERMINATED
>BY '\r\n'";
>mysql_query($query, $conn) or print(mysql_error());
>mysql_close($conn);
>
>Everything seems to be OK, no error messages, but when I
>open the table I see only new empty row created. What's
>wrong?

My guess would be that because \ in strings is special to both MySQL *and*
PHP, you'll need to specify \t and \r\n as \\t and \\r\\n.

-- 
Paul DuBois, paul@stripped
http://www.kitebird.com/
sql, query
Thread
LOAD DATA FILEnadusha14 Mar
  • Re: LOAD DATA FILEPaul DuBois14 Mar