Reading data from MySQL

From: Date: Mon, 05 Mar 2001 01:20:37 +0000
Subject: Reading data from MySQL
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-5820@lists.php.net to get a copy of this message
Hi folks, I have a problem. I think it's the way I'm inputting data into MySQL table. What I'm trying to do is insert data from a DOS text file into a MySQL Table. The DOS text file has a country name on each line, like: United Kingdom United States I'm trying to populate a MySQL table called Countries from the MySQL client like: LOAD DATA LOCAL INFILE "countries.txt" INTO TABLE Countries; All the records are created but when I echo them to screen with PHP every country has a space after it, like: "United Kingdom " What am I doing wrong? It's not my PHP code because if I create a table and manually fill it with values the space isn't present. However, I don't want to manually have to enter 290 odd countries into the table! So I'm assuming it's the input file format or I'm missing something on the LOAD DATA command? However, I have tried saving in every format present in Word (such as Text Only, MS DOS Only, etc) but with no success. The MySQL documentation says you can set the end of line marker explicitly in the LOAD DATA statement. How do you do this? Many thanks James

« previous php.windows (#5820) next »