<?php

include '../koneksi.php';

$id = $_POST['id'];

$nama = $_POST['nama'] ?? '';

$deskripsi = $_POST['deskripsi'] ?? '';

if(isset($_POST['geojson'])){

    $geojson = $_POST['geojson'];

    mysqli_query(

        $conn,

        "UPDATE objek_peta
        SET geojson='$geojson'
        WHERE id='$id'"

    );

}else{

    mysqli_query(

        $conn,

        "UPDATE objek_peta
        SET
        nama='$nama',
        deskripsi='$deskripsi'
        WHERE id='$id'"

    );

}

echo json_encode([
    'status'=>'success'
]);