Skip to content Skip to sidebar Skip to footer

Using Pdo For An Insert And The_geom

I'm switching my code to PDO for increased security. My insert works until I add a special column that create spatial data. See below for the standard insert that works, and 2nd be

Solution 1:

you cannot bind an arbitrary SQL part using prepared statement

but string or numeric literal only.

$geomstring4 = "'POINT(325123 215432)'";

$stmt5 = $conn ->prepare(
   "INSERT INTO sites_tbl (sitename, the_geom) VALUES (?, st_geomfromtext(?,27700)))");
$stmt5->bindParam(1, $sitename);

$stmt5->bindParam(2, $geomstring4);

Post a Comment for "Using Pdo For An Insert And The_geom"