[postgis-users] pg_query to insert new point

P Kishor punk.kish at gmail.com
Tue Oct 27 06:20:21 PDT 2009


2009/10/27 André Mendonça <andremalms at hotmail.com>:
> Hi everyone, first e-mail here.
> I´m trying to insert a new point to a simple table called processos in a
> postgis database, using php, in a local server, with apache 2.2, php 5.2.12,
> postgre 8.3 and postgis 1.4.
>
> here is the piece of code:
>
> $sql = "INSERT INTO processos (id, the_geom) VALUES
> (1,(ST_PointFromText('POINT(-2 -62)',4291)))";
> pg_query($con, $sql);
>
>
>
>
> I can observe (with pg_affected_rows) there´s no new record.
>
> Executing the same query directly in pgsql, with the same database user,
> returns a successfully result.
>
> Any ideas on what´s wrong?

Perhaps your php db connection has auto commit turned off, so you have
to explicitly COMMIT after INSERT.


> I had never done any queries using php before, is
> there a way to see an error message when executing this kind of server-side
> request? tried firebug console but there´s nothing going on there...
>
> Thanks a lot!
>
> André Mendonça
> Universidade Federal do Paraná
> Curitiba - BR
>
>
>
> ________________________________
> Com o Novo Internet Explorer 8 suas abas se organizam por cor. Baixe agora,
> é grátis!
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>



-- 
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================
Sent from Madison, WI, United States



More information about the postgis-users mailing list