Project UAS Sistem Informasi Geografis (SIG)

This commit is contained in:
2026-06-08 20:24:54 +07:00
commit c6087ed7dd
33 changed files with 4549 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
<?php
header('Content-Type: application/json');
include 'db.php';
$id = intval($_GET['id'] ?? 0);
$type = $_GET['type'] ?? '';
if ($id == 0 || $type == '') {
echo json_encode(["message" => "Parameter tidak valid"]);
exit;
}
$table = '';
if ($type == 'point') $table = 'spbu';
if ($type == 'line') $table = 'jalan';
if ($type == 'polygon') $table = 'parsil';
if ($type == 'masjid') $table = 'masjid';
if ($type == 'penduduk') $table = 'penduduk_miskin';
if ($table == '') {
echo json_encode(["message" => "Type tidak dikenali"]);
exit;
}
$stmt = $conn->prepare("DELETE FROM $table WHERE id = ?");
$stmt->bind_param("i", $id);
if ($stmt->execute()) {
echo json_encode(["message" => "Data berhasil dihapus"]);
} else {
echo json_encode(["message" => "Gagal hapus", "error" => $stmt->error]);
}
?>