stevesimo Posted June 14, 2007 Share Posted June 14, 2007 Hi, I am working on a PHP site at the moment which requires the user to enter a postcode or town name to search under. Does anyone know of any FREE resource on the internet where you can download UK town data either as XML, CSV or MySQL dump file. I really dont want to type this information out from scratch as I am sure there are plenty of people who have done this already. Many thanks, Steve Quote Link to comment https://forums.phpfreaks.com/topic/55593-list-of-uk-towns/ Share on other sites More sharing options...
chocopi Posted June 14, 2007 Share Posted June 14, 2007 You could do something like this and then copy it into your "run SQL queries" section <?php $lines = file("towns.txt"); foreach($lines as $line) { $line = trim($line); echo "$query = \"INSERT INTO tablename (fieldname) VALUES ('$line')\";<br />"; } ?> and then in towns.txt have the names stored on new lines like this: Abingdon Accrington Acton Adlington Alcester etc etc Hope that helps ~ Chocopi Quote Link to comment https://forums.phpfreaks.com/topic/55593-list-of-uk-towns/#findComment-274733 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.