Pembaruan pertama: Implementasi WebGIS CRUD dan Layer SPBU
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Kegunaan: Menghapus data secara permanen dari tabel yang relevan.
|
||||
*/
|
||||
header('Content-Type: application/json');
|
||||
require 'koneksi.php';
|
||||
|
||||
$data = json_decode(file_get_contents("php://input"), true);
|
||||
|
||||
try {
|
||||
if ($data['type'] === 'jalan') {
|
||||
$stmt = $koneksi_pdo->prepare("DELETE FROM jalan WHERE id = ?");
|
||||
}
|
||||
else if ($data['type'] === 'persil') {
|
||||
$stmt = $koneksi_pdo->prepare("DELETE FROM persil_tanah WHERE id = ?");
|
||||
}
|
||||
else if ($data['type'] === 'spbu') {
|
||||
$stmt = $koneksi_pdo->prepare("DELETE FROM spbu WHERE id = ?");
|
||||
}
|
||||
|
||||
if (isset($stmt)) {
|
||||
$stmt->execute([$data['id']]);
|
||||
}
|
||||
|
||||
echo json_encode(["status" => "success"]);
|
||||
} catch (PDOException $e) {
|
||||
echo json_encode(["status" => "error", "message" => $e->getMessage()]);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user