0

Hello Forum:

I am trying to write a php script that will take as input a zip code and output the zip code with its respective city and state with the name of any companies/businesses in that zip code. Ok, I got this part working. The other part is that if the user enters a zip code that either does not exist or there is no businesses in that zip code, then the output would be a range of zip codes within, let us say, 5 miles from the zip code the user entered. I have a database with all the zip codes, latitude, longitude, city, and state columns.

Is there anyone who can help me code this in php? Thanks.
--Willie

Edited by williebens: n/a

4
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by kylegetson
0

Wasn't this topic discussed about 5 weeks ago on this forum? Have a search. The solution, if I recall used maths (trig) functions.

0

Wasn't this topic discussed about 5 weeks ago on this forum? Have a search. The solution, if I recall used maths (trig) functions.

I did search before posting, but I did not find a solution. I will post my solution when I find it.

Thanks for the suggestion.

Edited by williebens: n/a

0

There are plenty of references on calculating the distance between two coordinates, but since you're only interested in an approximate 5 mile radius, you could just use the Pythagorean theorem and assume the curvature is negligible dist = sqrt( (x2-x1)^2 + (y2-y1)^2 ) edit: You might find this post helpful: http://www.daniweb.com/forums/thread151916.html

Edited by Ezzaral: n/a

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.