views:

43

answers:

2
  1. So here's the issue... I have a field where users can type in their address (which will be GeoCoded via Google Maps API).
  2. I have several addresses of widgets in my database (saved as address.. again can easily be geocoded).

What I need is for the user to type in their address and for a list of my widgets to come up based on distance from their address. I have THOUSANDS of addresses for my widgets and users have an infinite number of addresses obviously.

Any ideas?

Thanks.

A: 

http://rafeekphp.wordpress.com/2009/04/17/calculate-distance-using-google-maps-api/

ghoppe
This is fine for 2 points, but how do I do this for ALL my addresses in real time as the user types in his/her address?
Shamoon
Through the use of a `for .. next` loop? Your widgets will already have been geocoded and stored in the database. After you geocode the user's address through an API call, it's just a matter of mathematics. Even thousands of addresses should only take a matter of seconds.
ghoppe
+1  A: 

If you are storing the items in a MySQL DB, then here's the basis what you need

easement