27 lines
685 B
PHP
27 lines
685 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 spbu_point WHERE id = ?");
|
|
$stmt->bind_param("i", $id);
|
|
|
|
if ($stmt->execute()) {
|
|
echo json_encode(["status" => "success", "message" => "Data berhasil dihapus"]);
|
|
} else {
|
|
echo json_encode(["status" => "error", "message" => "Gagal menghapus data: " . $stmt->error]);
|
|
}
|
|
|
|
$stmt->close();
|
|
} else {
|
|
echo json_encode(["status" => "error", "message" => "ID tidak valid"]);
|
|
}
|
|
|
|
$conn->close();
|
|
?>
|