I have a PostGIS table of points. With my php code and pdo, I want to add a point in it. I have the coordinates, I want to get the geometry, with ST_GeomFromText. Here is the code :
$x = $_POST['x']; $y = $_POST['y']; $geom="ST_GeomFromText('POINT($x $y)',2154)"; $r = $bdd->prepare("INSERT INTO ouvragesp (id, yl93, xl93,annee,geom) VALUES(:identifiant , :y , :x , 2017, :geom)"); $r->execute(array( 'identifiant' => $id, 'x' => $x, 'y' => $y, 'geom' => $geom));
However, when I execute it, it tells me that :
PDOStatement::execute(): SQLSTATE[XX000]: Internal error: 7 ERROR: parse error - invalid geometry HINT: "ST" <-- parse error at position 2 within geometry
I don't see why it takes only "ST" part.
Does someone know where the problem comes from and how to solve it ?