scotchegg78 Posted December 9, 2008 Share Posted December 9, 2008 Hi guys I have a CSV File like below... Birmingham," B1,B12,B37" London," SW1,SW2" I need to parse this with php to get it into a table postcode for each postcode and town, example Birmingham B1 Birmingham B12 Birmingham B37 London SW1 London SW2 Are there any good re usable php mysql cvs classes? thanks for any help Quote Link to comment https://forums.phpfreaks.com/topic/136196-csv-php-mysql/ Share on other sites More sharing options...
gevans Posted December 9, 2008 Share Posted December 9, 2008 What is your mysql table layout?? Quote Link to comment https://forums.phpfreaks.com/topic/136196-csv-php-mysql/#findComment-710440 Share on other sites More sharing options...
gevans Posted December 9, 2008 Share Posted December 9, 2008 Also is the csv only 2 columns? the second column needing to be split? Quote Link to comment https://forums.phpfreaks.com/topic/136196-csv-php-mysql/#findComment-710442 Share on other sites More sharing options...
scotchegg78 Posted December 9, 2008 Author Share Posted December 9, 2008 Hi guys sorry was a little vague. mysql table... poscode,town,county,city. csv file is in the order... town, county,postcode,city. And can be like this... Aberdeen,Aberdeenshire,"AB1, AB2",Aberdeen,Scotland "Aberlour, Turriff","Aberdeenshire, Banffshire, Kincardineshire",AB3,Aberdeen,Scotland where a postcode can also cover mulitple towns. TO be honest I am a little confused now, i need to think how best to store this in the db and use it, as a post code can have many towns, and a town many postcodes! I have a table of postcodes and lats and longs, and i wanted to add a column or reference table so i can also work out distance from a name by finding its postcode. Get me? Quote Link to comment https://forums.phpfreaks.com/topic/136196-csv-php-mysql/#findComment-710461 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.