0

hi,

i have a client request which i am unsure how to achieve. i need to be able to search the mysql database for the closest post code to a person who enters in their post code.

so for example a user types in post code nn1 1ne and the databse needs to display the results in order of closest to that post code of available shops for that user.

can this be done with mysql alone or does this need a scripting languagge to achieve this such as php?

many thanks

3
Contributors
7
Replies
8
Views
6 Years
Discussion Span
Last Post by mrhankey
0

If you have geo-coordinates for the postcodes, you can set up a function which calculates the distance between two postcodes and a query which selects the minimum. You can do the math also in an inline function - look up "distance geo-coordinates" in google.

0

thanks, i doubt i would have the geo-cordinates unless i could obtain it from somewhere, the user would simply be entering their zip code to then seach closest matches. does anyone know of a way this can be achieved?

thanks

0

thanks the paf is still chargeable when you go to the site, do you know any free data sources?

thank you again

0

hi i had a look at this link, i am looking for united kingdom area. what is it i would need? the data source or a copy of the database to import?

how would i do a query to search by closest to a particular post code similar to what you get on car sites or property sites where you search by post code and it brings up closest results first?

any help greatly greatly appreciated with this project.

many thanks

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.