22 lines
642 B
PHP
22 lines
642 B
PHP
<?php
|
|
header('Content-Type: application/json');
|
|
include 'db_config.php';
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$id = $_POST['id'];
|
|
$nama = $_POST['nama'];
|
|
$nomor = $_POST['nomor'];
|
|
$status = $_POST['status'];
|
|
|
|
$stmt = $conn->prepare("UPDATE locations SET nama = ?, nomor = ?, buka_24jam = ? WHERE id = ?");
|
|
$stmt->bind_param("sssi", $nama, $nomor, $status, $id);
|
|
|
|
if ($stmt->execute()) {
|
|
echo json_encode(['status' => 'success', 'message' => 'Data diperbarui']);
|
|
} else {
|
|
echo json_encode(['status' => 'error', 'message' => $stmt->error]);
|
|
}
|
|
$stmt->close();
|
|
}
|
|
$conn->close();
|
|
?>
|