Actually, the US Census Bureau provides the information for free, but you have to do some work to associate a ZIP code with the data they provide. Since zip codes dont have any real shape to them, and change often, the census people have assigned their own numbers to different areas. We've found it easier to to just ask the user for the state in which they live, and then the city, choosing the city from the database that most closely resembles what they said.

At that URL you can download all of the information in a text format. With that information you get the lat/long coords of the cities, and it just takes the formula (to long to remember) to find the distance between the two points on a sphere.

Good luck.

gilrain wrote:

Hi folks,

I'm building a PHP/MySQL database for a customer. It's an advanced mailing
list for a band. They want to be able to send e-mails targetted to people
around where a gig takes place. For instance, if a concert is taking place
somewhere in the 42071 zipcode, they want to e-mail everyone within 500
miles of 42071. The database will have around 10,000 members, with e-mail
and mailing addresses.

Does anyone have a good idea for this?

Thanks a ton,

John Thile (gilrain)

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to