27 lines
725 B
PHP
27 lines
725 B
PHP
<?php
|
|
header("Content-Type: application/json; charset=UTF-8");
|
|
include_once '../db_connect.php';
|
|
|
|
$query = "SELECT * FROM spbu";
|
|
$result = $conn->query($query);
|
|
|
|
$spbu_arr = array();
|
|
|
|
if($result->num_rows > 0) {
|
|
while($row = $result->fetch_assoc()) {
|
|
$spbu_item = array(
|
|
"id" => $row['id'],
|
|
"nama" => $row['nama'],
|
|
"no_wa" => $row['no_wa'],
|
|
"is_24_jam" => (bool)$row['is_24_jam'],
|
|
"lat" => (float)$row['lat'],
|
|
"lng" => (float)$row['lng']
|
|
);
|
|
array_push($spbu_arr, $spbu_item);
|
|
}
|
|
echo json_encode(["status" => "success", "data" => $spbu_arr]);
|
|
} else {
|
|
echo json_encode(["status" => "success", "data" => []]);
|
|
}
|
|
?>
|