<?php
include 'koneksi.php';

header('Content-Type: application/json; charset=utf-8');

$query = mysqli_query($koneksi, "SELECT id, nama_spbu, no_wa, status_24_jam, lat, lng FROM `$nama_tabel`");
$data = [];

while ($row = mysqli_fetch_assoc($query)) {
    $row['lat'] = floatval($row['lat']);
    $row['lng'] = floatval($row['lng']);
    $data[] = $row;
}

echo json_encode($data);
?>
