Basically, I have a database that is configured in Longitude and Latitude. Iβve been trying for several hours to fix the problem with MySql and I canβt find my error. Here is the error I get:
You have an error in the SQL syntax; check the manual that matches the version of your MySQL server for the correct syntax used near longitude longitude) * PI () / 180)) * 180 / PI ()) * 60 * 1.1515) * 1.609344) AS distance 'at line 1
Here is the MySql database query to get the distances from long and lat:
$res = mysql_query("SELECT *, (((ACOS(SIN(".$latitude." * PI() / 180) * SIN(latitude * PI() / 180) + COS(".$latitude." * PI() / 180) * COS(latitude * PI() / 180) * COS((".$longitude." β longitude) * PI() / 180))* 180 / PI()) * 60 * 1.1515)*1.609344) AS distance") or die(mysql_error());
Please, please help !!!
source share