Initial WebGIS portal project
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
require_once 'db_pdo.php';
|
||||
require_once 'auth.php';
|
||||
require_admin_login(true);
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$input = json_decode(file_get_contents('php://input'), true);
|
||||
|
||||
if (!$input || empty($input['id'])) {
|
||||
echo json_encode(['success' => false, 'message' => 'Input tidak valid']);
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
$stmt = $pdo->prepare("DELETE FROM penduduk_miskin WHERE id=?");
|
||||
$stmt->execute([$input['id']]);
|
||||
// Note: anggota_keluarga will be deleted automatically due to ON DELETE CASCADE
|
||||
|
||||
echo json_encode(['success' => true]);
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(['success' => false, 'message' => $e->getMessage()]);
|
||||
}
|
||||
Reference in New Issue
Block a user