laravel count distance lat 2flongtidue

Solutions on MaxInterview for laravel count distance lat 2flongtidue by the best coders in the world

showing results for - "laravel count distance lat 2flongtidue"
Rafael
06 Feb 2017
1$lat = 41.118491 // user's latitude
2$lng = 25.404509 // user's longitude
3
4SELECT *, 
5( 6371 * acos( cos( radians($lat) ) 
6* cos( radians( latitude ) ) 
7* cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) 
8* sin( radians( latitude ) ) ) ) 
9AS calculated_distance 
10FROM settings as T 
11HAVING calculated_distance <= (SELECT distance FROM settings WHERE sid=T.sid) 
12ORDER BY distance_calc
13