Re: Semi-newbie - postgres polygon/points and PHP?

From: Date: Mon, 18 Feb 2002 23:13:05 +0000
Subject: Re: Semi-newbie - postgres polygon/points and PHP?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-17040@lists.php.net to get a copy of this message
sorry the late reply, could you consider having each set of coordinates in 2 different fields? select r.x, r.y from room r andrés ----- Original Message ----- From: "Roger Southwick" <rogers@mediaforte.com> To: <php-db@lists.php.net> Sent: Saturday, February 16, 2002 12:18 AM Subject: [PHP-DB] Semi-newbie - postgres polygon/points and PHP? > Ok, a kinda newbie question. I set up a Postgres DB with a table that had a > Point and a Polygon in it (to hold XY and shape settings for munging a jpeg > image in php). > > I could not easily figure out how to extract the data into a reasonably easy > to use format in PHP. The best I could do seemed like it was extracted > into a string, and then I had to parse that. > While this works, it seems like a BIG hack to me, and the docs have been > less then forthcoming. > I've also tried the usual google search of "php postgres polygon" to see if > I could get an idea. > > For example, I stored the Point as: (432, 120) > And I got "(432, 120)" as a string, and had to parse it: > > ... > $Q = "SELECT * FROM room WHERE id=$id"; > > if(!($Result = pg_exec($Connection, $Q))) > { > print("Query failed $Q"); > print(pg_errormessage($Connection)); > print("<BR>\n"); > exit; > } > > $myroom = pg_fetch_array($Result, $i); > $xy = $myroom["xy"]; > $xyar = split("[\(,\)]", $xy); > $x = $xyar[1]; > $y = $xyar[2]; > ... > > > Any ideas? > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.db (#17040) next »