genzedu777 Posted December 28, 2010 Share Posted December 28, 2010 Hi all, I am currently facing an issue in importing CSV files into my database, due to the 'comma' issue As you can see in picture1.jpg, I have the fields terminated by 'comma'. The error happens in Picture2.jpg, as you can see through the red pointed arrow, No.5 'tutor_id' column became something else. It was due to No.2's tutor comment. No.2 tutor's comment was written in such "- 2 YEARS OF TEACHING EXP - 2 - PRI MATHS AND SCIENCE - BOTH ARE JUST GETTING PASSES IN THE SUBJECTS. AFTER 6 MONTHS, ONE GOT 75% AND THE OTHER 80%" Basically "ONE GOT 75% AND THE OTHER 80%" appears in No.5 tutor's tutor_id, and the one which is highlighted in blue and nowhere to be seen in No.2 tutor's comment, it has been chopped off (see picture3.jpg) Any idea how I should overcome this error? Should I set my 'fields terminated' as something else instead of the comma? Please help!! Thanks [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/222828-importing-of-csv-files-into-database/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 28, 2010 Share Posted December 28, 2010 You need to use Fields enclosed by " Quote Link to comment https://forums.phpfreaks.com/topic/222828-importing-of-csv-files-into-database/#findComment-1152192 Share on other sites More sharing options...
genzedu777 Posted December 29, 2010 Author Share Posted December 29, 2010 Thanks. It works! Quote Link to comment https://forums.phpfreaks.com/topic/222828-importing-of-csv-files-into-database/#findComment-1152468 Share on other sites More sharing options...
genzedu777 Posted December 29, 2010 Author Share Posted December 29, 2010 Hi, Surprisingly, after trying it back home, it didn't work well again. After placing an inverted comma in 'Fields enclosed by', and imported into the database, record 1, 2 and 10 appeared, but 3 - 9 were missing. Picture2.jpg shows the appeared records and example1.doc shows the file which I am importing May I know what is the possible reason that I have missing records? [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/222828-importing-of-csv-files-into-database/#findComment-1152588 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.