Errore nella query: SeLeCt a.id,a.name,a.city_id,a.lat,a.lon,a.address,a.postcode, ROUND(((ACOS(0.76698351364 * SIN(a.lat * 0.0174532925199) + 0.641666805909 * COS(a.lat * 0.0174532925199) * COS((16.4637985 - a.lon) * 0.0174532925199)) * 180 / 3.14159265359) * 111.044736),5) AS distance FROM comclass c JOIN companies a on a.id = c.comp_id AND c.cat_id = WHERE a.lon > 16.4187356 AND a.lon < 16.5088614 AND a.lat > 50.054863 AND a.lat < 50.1126938 ORDER by distance LIMIT 20 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE a.lon > 16.4187356 AND a.lon < 16.5088614 AND a.lat > 50.054863 AND a.' at line 4