19 lines
487 B
PHP
19 lines
487 B
PHP
<?php
|
|
header('Content-Type: application/json');
|
|
include 'db_config.php';
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$id = $_POST['id'];
|
|
|
|
$stmt = $conn->prepare("DELETE FROM locations WHERE id = ?");
|
|
$stmt->bind_param("i", $id);
|
|
|
|
if ($stmt->execute()) {
|
|
echo json_encode(['status' => 'success', 'message' => 'Data dihapus']);
|
|
} else {
|
|
echo json_encode(['status' => 'error', 'message' => $stmt->error]);
|
|
}
|
|
$stmt->close();
|
|
}
|
|
$conn->close();
|
|
?>
|