dragonusthei Posted September 14, 2007 Share Posted September 14, 2007 Im importing the following: "33996344","33996351","GB","GBR","UNITED KINGDOM" "50331648","69956103","US","USA","UNITED STATES" "69956104","69956111","BM","BMU","BERMUDA" "69956112","83886079","US","USA","UNITED STATES" "94585424","94585439","SE","SWE","SWEDEN" The Current PHP Reads: mysql_query("LOAD DATA LOCAL INFILE 'ip-to-country.csv' INTO TABLE ipcountry FIELDS TERMINATED BY ',' ENCLOSED BY '\"'"); However this is going wrong after the end of the line because theres no , how can i get round this? Quote Link to comment Share on other sites More sharing options...
pikemsu28 Posted September 14, 2007 Share Posted September 14, 2007 $query = "LOAD DATA LOCAL INFILE 'ip-to-country.csv' INTO TABLE ipcountry FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\r\n'"; the lines terminated by looks for the Return (\r\n) on the line from the manual: Note that if you created the file on Windows with an editor that uses \r\n as a line terminator, you should use: mysql> LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet -> LINES TERMINATED BY '\r\n'; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.