On Wed, Jun 17, 2009 at 06:37:12PM +0800, Tim Bowden wrote:
> On Wed, 2009-06-17 at 11:23 +0100, Tim Bunce wrote:
> > On Wed, Jun 17, 2009 at 04:13:35PM +0800, Tim Bowden wrote:
> > > my $sth = $dbh->prepare("INSERT INTO mygeom (description, mypoint)
> > > VALUES (?, ST_GeomFromText('POINT(? ?)', ?))");
> >
> > > $sth->bind_param(1, $_);
> > > $sth->bind_param(2, $coord);
> > > $sth->bind_param(3, $coord);
> >
> > The argument to ST_GeomFromText is a string. Naturally questionmarks
> > inside strings shouldn't be treated as placeholders.
> >
> > Use "INSERT INTO mygeom (description, mypoint) VALUES (?,
> > ST_GeomFromText(?, ?))"
> >
> > and $sth->bind_param(2, "POINT($coord $coord)");
> >
> > Tim.
>
> *smacks forehead*
>
> Obvious once it's pointed out. Thanks Tim. Much appreciated.
If it's any consolation, I did the same thing the first time I used geo
functions in SQL :-)
Tim.