I have successfully converted the ASP code included in the following article
to PHP:
As described the high and low latitudes and longitudes are pre-calculated
and passed to the query.
SELECT *
FROM Locations
WHERE Latitude <= $HighLatitude
AND Latitude >= $LowLatitude
AND Longitude >= $LowLongitude
AND Longitude <= $HighLongitude
I then calculate the actual distance using the latitude and longitude for
each zip returned.
This works great and saves lots of cycles. The downside to this technique is
the inability to sort by distance. Can someone suggest a simple way to
calculate and ORDER BY distance within the query?
Thanks!
to PHP:
As described the high and low latitudes and longitudes are pre-calculated
and passed to the query.
SELECT *
FROM Locations
WHERE Latitude <= $HighLatitude
AND Latitude >= $LowLatitude
AND Longitude >= $LowLongitude
AND Longitude <= $HighLongitude
I then calculate the actual distance using the latitude and longitude for
each zip returned.
This works great and saves lots of cycles. The downside to this technique is
the inability to sort by distance. Can someone suggest a simple way to
calculate and ORDER BY distance within the query?
Thanks!
Comment