On 6/27/2011 12:28 AM, Eric Sepich wrote:
<?php
$dbconn = pg_connect("host=localhost port=5432 dbname=postgismethane
user=root password=excedrin413");

$query = "SELECT * FROM polygons WHERE gid = 1";
$result = pg_exec($dbconn, $query);
if (!$result) {printf ("ERROR"); exit;}
$numrows = pg_numrows($result);
?>

I get one row returned but I just don't seem to have any kind of
documentation on what to do with it. I want to list the coordinates of
the polygon returned by my query. Does anyone know how to do that?

Try something like this:


<?php
   $dbconn = pg_connect("host=localhost port=5432 dbname=postgismethane
            user=root password=excedrin413");

    $query = "SELECT * FROM polygons WHERE gid = 1";
    $r = pg_exec($dbconn, $query);
    if (!$r) {printf ("ERROR"); exit;}

    $n = pg_num_rows($r);
    for ($i=0;  $i<$n; $i++) {
        printf("----- Row: %d -------\n", $i);
        $row = pg_fetch_assoc($r);
        pg_free_result($r);
        foreach ($row as $k=>$v)
            printf("%20s = %s\n", $k, $v);
    }
    pg_close($dbh);
?>
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to