_{1}-x

_{2})*(x

_{1}-x

_{2})+(y

_{1}-y

_{2})*(y

_{1}-y

_{2})). 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.