21 lines
627 B
PHP
21 lines
627 B
PHP
<?php
|
|
header("Content-Type: application/json; charset=UTF-8");
|
|
header("Access-Control-Allow-Methods: POST");
|
|
require_once '../koneksi.php';
|
|
|
|
$data = json_decode(file_get_contents("php://input"));
|
|
|
|
if (!empty($data->id)) {
|
|
try {
|
|
$stmt = $conn->prepare("DELETE FROM tanah_polygons WHERE id = :id");
|
|
$stmt->bindValue(':id', $data->id, PDO::PARAM_INT);
|
|
|
|
if($stmt->execute()) {
|
|
echo json_encode(["pesan" => "Parsil tanah berhasil dihapus."]);
|
|
}
|
|
} catch(PDOException $e) {
|
|
http_response_code(500);
|
|
echo json_encode(["error" => $e->getMessage()]);
|
|
}
|
|
}
|
|
?>
|