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

Sean M. Montague smontague at ATSDenver.com
Tue Feb 21 08:45:56 PST 2006


Thanks Don,

I am using php. Problem with pg_fetch_assoc() is that I need to know the
field name.  I want to be able to get the field name regardless of the
order I select them in the select statement.

Sean

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

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


_______________________________________________
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