I am trying order by desc distances. I have a database which contains a column called latlong
(latitude and longitude) and another one called user_id
. I have a function that calculates the distances between two places by using the latlong
in MySQL and it returns the distance in kilometers.
function calc($latlong1,$latlong2);
So, I would like to make a query that I can order by all the places by the near distance between each other. For example: Place A is near Place C then Place B. So the rank will be: Place A, Place C then Place B.