setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $dbcon->prepare("UPDATE interventi_point SET geom = ST_GeomFromText(:geometry, 25833) WHERE id = :id"); $stmt->bindValue(":id", $gid, PDO::PARAM_INT); $stmt->bindValue(":geometry", $geometry, PDO::PARAM_STR); if($stmt->execute()){ $response = array("response"=>"200","message"=>"updated"); header('Content-Type: application/json'); echo json_encode($response); $dbcon = null; exit; } else { $response = array("response"=>"500","message"=>$e->getMessage()); header('Content-Type: application/json'); echo json_encode($response); $dbcon = null; exit; } } catch (PDOException $e) { $response = array("response"=>"500","message"=>$e->getMessage()); header('Content-Type: application/json'); echo json_encode($response); $dbcon = null; exit; } } else { $response = array("response"=>"404","message"=>"Command is not properly set."); header('Content-Type: application/json'); echo json_encode($response); $dbcon = null; exit; } } else { $response = array("response"=>"404","message"=>"Command is not properly set."); header('Content-Type: application/json'); echo json_encode($response); $dbcon = null; exit; } ?>