I have a table including the x and y coordinates of a series of points on a grid and want to be able to select them in order of their distance from a given pair of x y coordinates (ie sqrt((x1
)). I can select OK and show the distance with the formula above with the query below
SELECT * FROM `points` ORDER BY '".strtolower($sortby)."' ".$direction
But sorting the results into the lowest and highest distances from the given point is proving beyond me for the moment!
It looks from the manual as if it should be possible. Your help would be appreciated.