Files
2026-06-07 19:10:40 +07:00

19 lines
430 B
PHP

<?php
include "db_config.php";
header('Content-Type: application/json');
$sql = "SELECT * FROM laporan_masyarakat ORDER BY created_at DESC";
$result = $conn->query($sql);
if (!$result) {
echo json_encode(["status" => "error", "message" => "Gagal membaca tabel laporan_masyarakat", "detail" => $conn->error]);
exit;
}
$data = [];
while ($row = $result->fetch_assoc()) {
$data[] = $row;
}
echo json_encode($data);
?>