27 lines
836 B
PHP
27 lines
836 B
PHP
<?php
|
|
header('Content-Type: application/json');
|
|
// Sesuaikan dengan konfigurasi database Anda
|
|
require_once '../config.php';
|
|
$conn = getDB();
|
|
|
|
$data = json_decode(file_get_contents("php://input"), true);
|
|
|
|
if ($data && isset($data['id']) && isset($data['geojson'])) {
|
|
$id = $data['id'];
|
|
$luas_m2 = $data['luas_m2'];
|
|
$geojson_string = json_encode($data['geojson']);
|
|
|
|
$stmt = $conn->prepare("UPDATE area_polygon SET luas_m2 = ?, geojson = ? WHERE id = ?");
|
|
$stmt->bind_param("dsi", $luas_m2, $geojson_string, $id);
|
|
|
|
if ($stmt->execute()) {
|
|
echo json_encode(["status" => "success"]);
|
|
} else {
|
|
echo json_encode(["status" => "error", "message" => $stmt->error]);
|
|
}
|
|
$stmt->close();
|
|
} else {
|
|
echo json_encode(["status" => "error", "message" => "Data tidak lengkap"]);
|
|
}
|
|
$conn->close();
|
|
?>
|