////
// fieldNames: gathers the names of the fields returned by the query.
// needs a vaild query result_id and an array to populate.
////
function fieldNames($query_id, &$fields) {
for ($i = 0; $i < $this->fieldCount; $i++) {
$fields[$i] = strtoupper(pg_FieldName($query_id, $i));
}
}
This is a method I use in my Postgres connection class. It works just fine.