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.
Tim Bowden