grantf Posted February 26, 2008 Share Posted February 26, 2008 Hi, i am just starting out with mySQL and i am trying to load data into a new table. By following the guide this is what i have typed. LOAD DATA LOCAL INFILE 'c:\file.csv' INTO TABLE people FIELD TERMINATED BY ','; i then get this as a responce Query OK, 5 rows affected (0.02 sec) Records: 5 Deleted: 0 Skipped: 0 Warnings: 0 then... when i SELECT * from people; the first field out of 3 fields is missing characters, see below +--------+-----------+------------+ | name | city | country | +--------+-----------+------------+ | ohn | sydney | australia | er | melbourne | america | | adelaide | england | | perth | spain | e | brisbane | italy +--------+-----------+------------+ 5 rows in set (0.00 sec) this is a copy of the orignal data john,sydney,australia peter,melbourne,america bob,adelaide,england alex,perth,spain george,brisbane,italy the source file is very basic, created in excel and saves as csv file, double checked in notepad++ Does anyone know what i am doing wrong?? Link to comment https://forums.phpfreaks.com/topic/93090-field-1-corrupt/ Share on other sites More sharing options...
beebum Posted February 26, 2008 Share Posted February 26, 2008 Try adding ...lines terminated by '\r\n' Link to comment https://forums.phpfreaks.com/topic/93090-field-1-corrupt/#findComment-476931 Share on other sites More sharing options...
grantf Posted February 27, 2008 Author Share Posted February 27, 2008 Hi, not sure if your suggestion would have worked however i got it working by adding a comma at the end of the line, ie... john,sydney,australia -> john,sydney,australia, and now it works perfectly. Thanks! Link to comment https://forums.phpfreaks.com/topic/93090-field-1-corrupt/#findComment-477946 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.