23 lines
649 B
PHP
23 lines
649 B
PHP
<?php
|
|
header("Content-Type: application/json; charset=UTF-8");
|
|
require_once '../auth_helper.php';
|
|
requireAdminOrPengelola();
|
|
include_once '../db_connect.php';
|
|
|
|
$data = json_decode(file_get_contents("php://input"));
|
|
|
|
if(!empty($data->id)) {
|
|
$id = (int)$data->id;
|
|
|
|
$query = "DELETE FROM penduduk_miskin WHERE id=$id";
|
|
|
|
if($conn->query($query)) {
|
|
echo json_encode(["status" => "success", "message" => "Berhasil dihapus."]);
|
|
} else {
|
|
echo json_encode(["status" => "error", "message" => "Gagal hapus: " . $conn->error]);
|
|
}
|
|
} else {
|
|
echo json_encode(["status" => "error", "message" => "ID tidak diberikan."]);
|
|
}
|
|
?>
|