View Full Version : MySQL Programmer Needed for Discount Network Website

11-16-2011, 01:24 AM
I'm currently working on a new website for a discount network of professionals. The clients are asking for a couple additions that I can't figure out.

First, they want a Zip Code Proximity search that will return the three closest professionals in the network database after the potential customer inputs their zip code on the site. It probably needs the use of the Haversine formula, I've found some code that does the calculation and have a zip code database, but I can't get it to work.

Second, once the three closest professionals are revealed, they see discounted prices for each. If the customer likes the price, they select it and lock in the price by placing a down payment. This is straight forward (and I can do this myself) but next the clients want the customer brought to a detailed page of the three professionals.

Let me know if anyone is interested and what your hourly and/or day rate is.


Old Pedant
11-16-2011, 02:28 AM
You are supposed to post things like this in the "Web Projects" forum.

Regarding need for haversine: No, not for zip codes. Haversine is only needed for extremely accurate results (e.g., to within 10 meters or so) and/or over long distances.

Zip codes are horribly inaccurate indicators of actual latitude/longitude. (In my own zip code, the "center" as given by post office tables is actually 6.5 miles from my house.)

So just using the pythagorean theorem is more than adequate for zipcode-based searches. (Again, unless you are talking distances of several hundred miles...I'd say 200 at a minimum, more likely 400.)

Here an old demo on one of my web sites:

The "trick" to making the query efficient is storing the latitude/longitudes in *MILES*, not in degrees.

On this page:
there is a link to a zip file you can download and study.

The code is written in ASP and uses an Access database, but the transformation to PHP and MySQL is pretty trivial.