Skip to main content
1 of 2

The bounding box query for SQL is(Using PDO)

$sql ="SELCT bussid FROM tablename WHERE(latitude  BETWEEN ? AND ? )AND (longitude  BETWEEN ? AND ?)";
$stmt = $dbh->prepare($sql);
// Assign parameters
$stmt->bindParam(1,$minLat);
$stmt->bindParam(2,$maxLat);
$stmt->bindParam(3,$minLng);
$stmt->bindParam(4,$maxLng);

WHERE parameters come from top left and bottom right of rectangle