[postgis-users] pg_query to insert new point

Tom Glancy Tom.Glancy at dnr.state.mn.us
Tue Oct 27 08:00:23 PDT 2009


You are missing a semicolon to end the SQL statement. Try

$sql = "INSERT INTO processos (id, the_geom) VALUES
(1,(ST_PointFromText('POINT(-2 -62)',4291)));";
pg_query($con, $sql);


Regards,
Tom




---------------------------------------
Tom Glancy
Ecological Resources Division IT Manager

tom.glancy at dnr.state.mn.us
651-259-5097

Minnesota Department of Natural Resources
500 Lafayette Road - Box 25
St. Paul, MN 55155-4025
---------------------------------------
>>> André Mendonça <andremalms at hotmail.com> 10/27/09 2:03 AM >>>

Hi everyone, first e-mail here.
Í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) theré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? 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 therés nothing going
on there...

Thanks a lot!

André Mendonça
Universidade Federal do Paraná
Curitiba - BR


 		 	   		  
_________________________________________________________________
Você sabia que pode acessar o Messenger direto do seu Hotmail? Descubra
como!
http://www.microsoft.com/brasil/windows/windowslive/products/tutoriais.aspx



More information about the postgis-users mailing list