Hello everyone i am trying to create an advanced search for restaurants with many filters for the user to select. One of the them is going to be the distance between his/her home and the restaurants. So i want to use a function in sql where it gets the two latitudes and two longitudes and checks if the distance is smaller than the filter.
I' ve found some solutions in here such as
Calculating distance between two points (Latitude, Longitude) but i just cant create the function no matter i do. I always get the same error " #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use". I even try to create a more simple function such as How to create a function in SQL Server but i still get the same error. I simply copy the function and paste it in my server to run a sql query on database.
Is there something that i m missing?? (maybe the create function is not supported anymore?).
Thanks in advance for any suggestions/answers.