Thank you both for your help so far, I'm so much closer now. I'd like to limit the search, yes, as the coordinate system is indeed a handfull.
allright, I've got it working with the first example, but one gives a bit weird results, but these two codes give me different results, which I can't even see the difference between:
code 1, working as should, sorting by distance:
$query = "SELECT id, x, y, SQRT(($inputX - x)*($inputX - x) + ($inpuY - y)*($inputY - y)) as distance
FROM mytable
ORDER BY distance";
and the second one, which sorts in a pseudo-close to correct way:
$query = "SELECT id, x, y, SQRT(($inputX - x)*($inputX - x) + ($inputY - y)*($inputY - y)) as distance
FROM mytable
ORDER BY distance";
Though the one part I really want to get to work, is this , but i can't manage to get it to work, the WHERE line is the problem :
$query = "SELECT id, x, y, SQRT(($inputX - x)*($inputX - x) + ($inputY - y)*($inputX - y)) as distance
FROM mytable
WHERE SQRT(($inputX - x)*($inputX - x) + ($inputY - y)*($inputY - y)) < $maxdist
ORDER BY distance";