sql select km from longitude lalitude distance php

Solutions on MaxInterview for sql select km from longitude lalitude distance php by the best coders in the world

showing results for - "sql select km from longitude lalitude distance php"
Claude
21 Aug 2018
1// first-cut bounding box (in degrees)
2$maxLat = $lat + rad2deg($rad/$R);
3$minLat = $lat - rad2deg($rad/$R);
4$maxLon = $lon + rad2deg(asin($rad/$R) / cos(deg2rad($lat)));
5$minLon = $lon - rad2deg(asin($rad/$R) / cos(deg2rad($lat)));
6
7$sql = "Select Id, Postcode, Lat, Lon
8        From MyTable
9        Where Lat Between :minLat And :maxLat
10          And Lon Between :minLon And :maxLon";
11
12
13$r = $db->prepare("SELECT * FROM location WHERE laltutide Between :minlat AND :maxlat
14                   AND longetude between :minlon AND :maxlon");
15
16$r->execute();
17
18$r = $r->fetchAll(PDO::FETCH_OBJ);
19
20