Answers for "sql select km from longitude lalitude distance php"

PHP
0

sql select km from longitude lalitude distance php

// first-cut bounding box (in degrees)
$maxLat = $lat + rad2deg($rad/$R);
$minLat = $lat - rad2deg($rad/$R);
$maxLon = $lon + rad2deg(asin($rad/$R) / cos(deg2rad($lat)));
$minLon = $lon - rad2deg(asin($rad/$R) / cos(deg2rad($lat)));

$sql = "Select Id, Postcode, Lat, Lon
        From MyTable
        Where Lat Between :minLat And :maxLat
          And Lon Between :minLon And :maxLon";


$r = $db->prepare("SELECT * FROM location WHERE laltutide Between :minlat AND :maxlat
                   AND longetude between :minlon AND :maxlon");

$r->execute();

$r = $r->fetchAll(PDO::FETCH_OBJ);
Posted by: Guest on May-11-2020

Code answers related to "sql select km from longitude lalitude distance php"

Browse Popular Code Answers by Language