26 lines
587 B
PHP
26 lines
587 B
PHP
<?php
|
|
include "db_config.php";
|
|
header('Content-Type: application/json');
|
|
|
|
$kemiskinan_id = intval($_GET['kemiskinan_id'] ?? 0);
|
|
|
|
if ($kemiskinan_id <= 0) {
|
|
echo json_encode(["status" => "error", "message" => "kemiskinan_id tidak valid"]);
|
|
exit;
|
|
}
|
|
|
|
$sql = "SELECT * FROM histori_bantuan WHERE kemiskinan_id=$kemiskinan_id ORDER BY tanggal DESC";
|
|
$result = $conn->query($sql);
|
|
|
|
if (!$result) {
|
|
echo json_encode(["status" => "error", "message" => $conn->error]);
|
|
exit;
|
|
}
|
|
|
|
$data = [];
|
|
while ($row = $result->fetch_assoc()) {
|
|
$data[] = $row;
|
|
}
|
|
echo json_encode($data);
|
|
?>
|