Project UAS Sistem Informasi Geografis (SIG)
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
include 'db.php';
|
||||
|
||||
$data = json_decode(file_get_contents("php://input"), true);
|
||||
|
||||
if (!$data) {
|
||||
echo json_encode(["message" => "Data kosong"]);
|
||||
exit;
|
||||
}
|
||||
|
||||
$id = intval($data['id'] ?? 0);
|
||||
$geom = $data['geom'] ?? '';
|
||||
$luas = $data['luas'] ?? 0;
|
||||
|
||||
$stmt = $conn->prepare("UPDATE parsil SET geom = ?, luas = ? WHERE id = ?");
|
||||
$stmt->bind_param("sdi", $geom, $luas, $id);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
echo json_encode(["message" => "Berhasil diupdate"]);
|
||||
} else {
|
||||
echo json_encode(["message" => "Gagal update", "error" => $stmt->error]);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user