19 lines
430 B
PHP
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);
|
|
?>
|