[thelist] Turn pg_query result into lines with three fields [php]
Stefan Schwarzer
st.schwarzer at geois.de
Thu Nov 13 07:01:36 CST 2008
Hi there,
I am not much of an expert. The normal display of postgres query
results works well for me. But now I would like to convert a table
(query) like this one
id y1970 y1971 y1972 ......
1 23 25 28
2 8 9 5
3 83 94 102
into an XML with this format
id, year, value
Seems to me that I can't use the pg_fetch_array, as it doesn't enable
me to read the column title (the year). There is pg_fieldname for
that, but then I would have to loop first this one, then the values.
I guess there is a more efficient way to obtain what I want, no?
Thanks for any hints,
Stef
More information about the thelist
mailing list