I have this table.
wppl_friends_locator
The table have columns named
lat float(10,6)
long float(10,6)
These columns have lat and long saved of entries, now i am trying to get results within radius of 30 miles from a given lat,long.
Sql does not return any results for some reasons which i am unable to figure out, below is the sql
SELECT
member_id,
(3959 * ACOS(
COS(RADIANS(-19.943379)) *
COS(RADIANS('lat')) *
COS(RADIANS('long') - RADIANS(-43.9521885)) +
SIN(RADIANS(-19.943379)) *
SIN(RADIANS('lat'))
)) AS distance
FROM
wppl_friends_locator
HAVING
distance < 30
ORDER BY
distance;
so even if i do an entry in this table with same lat long which I am providing in sql query, It still does not return any results.
I have been stuck on it for few days, any help would be appreciated.
Table structure