initial commit

This commit is contained in:
cindy
2026-06-10 19:20:46 +07:00
commit ec94359f9a
21 changed files with 23023 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
<?php
header('Content-Type: application/json');
try {
require_once __DIR__ . '/../koneksi.php';
// Cek koneksi
if (!isset($conn) || $conn->connect_error) {
throw new Exception("Database connection failed");
}
$result = $conn->query("SELECT * FROM spbu ORDER BY created_at DESC");
if (!$result) {
throw new Exception("Query failed: " . $conn->error);
}
$data = array();
while ($row = $result->fetch_assoc()) {
$data[] = $row;
}
echo json_encode($data);
} catch (Exception $e) {
echo json_encode([
'error' => true,
'message' => $e->getMessage()
]);
}
if (isset($conn)) {
$conn->close();
}
?>