php - How to add geopoint array, via PDO to crate* -
i have crateio set , it's working fine using pdo class.
i'm, trying set of geopoints db using binds.
i have tried foreach doesn't seem work, i've tried - doesn't work.
the geopoint column set geo_point_array.
$route="[[30.33333, -6.13336],[30.33333, -6.13336]]"; $db = new database; $db->query("insert geopoints (id, longlat, name) values ('33',?,'pat')"); $db->bind(1, $route); $db->execute();
how add set of cordinates db?
thanks
geopoint not supported native type in crate's pdo driver yet, can use double array.
from crate documentation:
columns geo_point represented , inserted using double array in following format: [lon_value, lat_value]
i recommend parameter substitution other values.
use crate\pdo\pdo; $route = [[30.33333, -6.13336], [30.33333, -6.13336]]; $db = new pdo('crate:...'); $stmt = $db->query("insert geopoints (id, longlat, name) values (?, ?, ?)"); $stmt->bind(1, 33, pdo::param_int); $stmt->bind(2, $route, pdo::param_array); $stmt->bind(3, 'pat', pdo::param_str); $stmt->execute();
Comments
Post a Comment