Importing a large CSV file into MySQL
If you are like me, one who loves open-source/GPL software, the internet is my playground. Yet, I’m not a programmer, so the hills are higher and tougher to conquer than the educated/experienced/skilled climber. I can a lot of things, but I’m not a master of any. It’s a paraphrase that describes me very well.
So, I got this idea to add the country and city labels to visitor info in some web reports I’m scripting. I can get and find country info via IP, but city information appears to be something you must buy for around $20US, the lowest I’ve see in one hour of googling.
I, instead, just go with one of the Country GEOIP dbs. But, I have a problem, I can’t read the entire list in Excel. So, I google for a script to import a ‘CSV file into MySQL’ and get a decent list. A free membership-only requirement to download a script ends up not working! So, I try more and find something in a forum at http://www.modwest.com/help/kb6-253.html, and IT WORKS! Checking the data via PHPMyAdmin (my fav) shows ‘success’!
Basically, copy the code, replace one or two items for your situation, add the database connection info before the clipped info and make the file a php doc. Now, call it via the web browser!
I am happy! Now, I’m putting it aside for now while I work on other things…I hope I get to it soon, but as you and I know, priorities change with every tock of the clock.
BTW, when I changed from Filemaker to MySQL, I paid something like $49US for a kludgy series of steps to convert the native FMPro data to get it into MySql. If I had any brain back then, I would have simply used a search engine and did what I did for this issue! Damn!

