Import CSV using phpmyadmin

I'm trying to import a csv file into a mysql database using the import functionality of phpmyadmin. I've attached the csv file and a screenshot of the structure of the table. entities table structure load-entities.csv

I always select "," for "Fields terminated by:" and blank for "Fields enclosed by:". I leave "Lines terminated by:" as "auto" but I'm not sure if this is correct since the most I can get is 1 line to be imported.

If I use "CSV" as the "Format of imported file" option, I get an error message:
"Invalid field count in CSV input on line 1."

If I use "CSV using Load Data" as the "Format of imported file" option, I get a message that the import is successful, but only 1 line of data is imported and the fields are screwed up.

I also tried removing the field (column) names from the import file and putting them in the "Column names" box in the import screen, but that didn't work either.

Any suggestions on how I can get this to work would be much appreciated.
opikeAsked:
Who is Participating?
 
Dave BaldwinFixer of ProblemsCommented:
Your file has a BOM for Unicode/UTF-8 as the first two bytes of the file which may throw the import function off it is not recognized.  Select UTF-8 as the character set.  ',' for "Fields terminated by:" is good but you should probably specify double quotes as for "Fields enclosed by:" because that is what you will get from something like Excel.  

If 'country_id' is a numeric column in your database, you will probably have to eliminate the header row because the word 'country_id' is not a number.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.