""" \n SELECT *\n FROM `#__gdwgestion_servicepoint`\n WHERE CalculateDistance(, , `lat`, `lng`)<=50 AND `published`=1\n ORDER BY CalculateDistance(, , `lat`, `lng`) ASC,`ordering` ASC """You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' , `lat`, `lng`)<=50 AND `published`=1 ORDER BY CalculateDistance(, , `lat`, ...' at line 3