1st commit: version 1.0 WebGis-Pemetaan-Kemiskinan
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
// otak_spbu/api_hapus_spbu.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 spbu_markers WHERE id = :id");
|
||||
$stmt->bindValue(':id', $data->id, PDO::PARAM_INT);
|
||||
|
||||
if($stmt->execute()) {
|
||||
echo json_encode(["pesan" => "SPBU berhasil dihapus."]);
|
||||
}
|
||||
} catch(PDOException $e) {
|
||||
http_response_code(500);
|
||||
echo json_encode(["error" => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user