Get results from mysql based on latitude longitude
You can calculate a distance using a Spherical law of cosines:
SELECT DEGREES(ACOS(SIN(RADIANS(clients.latitude)) * SIN(RADIANS(schools.latitude)) + COS(RADIANS(clients.latitude)) * COS(RADIANS(schools.latitude)) * COS(RADIANS(clients.longitude – schools.longitude)))) * 60 * 1.1515 * 1.609344 AS distanceFROM clients, schools HAVING distance < $radius
RADIANS(X) - degrees to radians
ACOS(X) - the arc cosine of X, that is, the value whose cosine is X
DEGREES(X) - radians to degrees
60 - minutes in a degree
1.1515 - miles in a nautical mile
1.609344 - kilometres in a mile