
December 28th, 2012, 10:35 AM
|
 |
Lost in code
|
|
|
|
|
Actually what you want to do is completely clear, the technical details of your system are the vague part.
For example: what location data do you store for your managers - if the store the post code and town name, then you can perform a simple equals select query to fetch a list of managers belonging to that post code or town. If you store one but not the other, then you're going to need a database of locations so that you can map between them.
The part about fetching nearby results (that don't match the post code or town name exactly) is more complicated. In order to do this, you need a database the maps post codes and town names to lat/long coordinates. Then when the user enters a post code or town name, you look up its lat/long and then perform a radius search around it to locate other post codes / town names within that area. Modern versions of MySQL have built-in support for performing a spatial search like this.
|