[postgis-users] Identifying field names in select out of order

Don Drake don at drakeconsult.com
Mon Feb 20 16:54:49 PST 2006


Are you using PHP?  

You really want to use pg_fetch_assoc() which returns the row in an
associative array.  Similar methods exist in the Perl libraries as well.

-Don

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Sean M.
Montague
Sent: Monday, February 20, 2006 5:54 PM
To: PostGIS Users Discussion
Subject: [postgis-users] Identifying field names in select out of order

This is PostgreSQL specific question. I'm iterating through my selection
and need to get the field name of my data[$i] where
$data=pg_fetch_row($result, $i). I've tried pg_fieldname($result, $i),
but the problem is that the field names in the select statement are not
in the same order as the db, so pg_fieldname(result, $i) is not the
filed from which data[$i] is drawn from.  Is there another way of
determining which field data[$i] comes from regardless of the field
order?  Thank you.

Sean
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users





More information about the postgis-users mailing list