I have a problem in a MYSQL query ran from a php script.
In my sql statement I need to filter all the users that are too far away so:
SELECT
...
ROUND(ACOS(SIN(RADIANS($Lat)) *
SIN(RADIANS(s.Latitude)) +
COS(RADIANS($Lat)) *
COS(RADIANS(s.Latitude)) *
COS(RADIANS(s.Longitude) -
RADIANS($Lon))) * $unitKm, 2) AS "Distance"
...
HAVING "Distance" <= $Dis
Now, there's a user that is 440.55 Km away but, if I pass 334 as "Dis", it's not filtered.
333 is ok, but when bigger than 333, the HAVING clause does not work.
I pass $Dis as a number and get it from php via a:
$Dis = filter_input(INPUT_GET, 'Dis');
How could I solve the problem ?