Hay i want to find the distance (in miles) between 2 locations using lat and long values, and check if they are within a 10 mile radius of each other.
When a user lo
I'm just going to leave this here:
https://gist.github.com/899413
it's an example on how to query within a square (BETWEEN) on integers and cut down the results with SQRT() to have the output return a round radius of results. (it also returns the distance in kilometer)
to do this you need to convert all points, when inserting, to kilometers to lay them out on a flat map. (see php functions)
the result is an incredible fast integer lookup - MUCH faster than doing all the calculations within the query like every single answer here states.
(I built this exactly 10 years ago... seems like it's still the smartest solution with mysql)