Files
webgis-pemetaan-sosial/Pertemuan02/hapus_area.php
T

19 lines
531 B
PHP

<?php
header('Content-Type: application/json');
require_once '../config.php';
$conn = getDB();
$data = json_decode(file_get_contents("php://input"), true);
if ($data && isset($data['id'])) {
$id = $data['id'];
$stmt = $conn->prepare("DELETE FROM area_polygon WHERE id = ?");
$stmt->bind_param("i", $id);
if ($stmt->execute()) {
echo json_encode(["status" => "success"]);
} else {
echo json_encode(["status" => "error", "message" => $stmt->error]);
}
$stmt->close();
}
$conn->close();
?>