"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]); } ?>