[thelist] PHP/SQL query & transformation problem
Stefan Schwarzer
st.schwarzer at geois.de
Wed Sep 12 03:41:20 CDT 2007
Hi there,
I want to redesign my database, as was recommended to me from
different sides. Although design is pretty clear, the result - and
the way to program it in PHP is really different.
As a result from my PostGres query I get something like this:
year | value | name
---------------------------------------
2001 | 123 | Afghanistan
2002 | 125 | Afghanistan
2003 | 128 | Afghanistan
2004 | 132 | Afghanistan
2005 | 135 | Afghanistan
2001 | 412 | Albania
2002 | 429 | Albania
2003 | 456 | Albania
2004 | 465 | Albania
2005 | 477 | Albania
.....
The way it is displayed on the web (in table form) is the "usual" way:
name 2001 2002 2003 2004 2005
-----------------------------------------------------------------
Afghanistan ....
Albania ....
So, I wonder, how to I get from the above SQL result - via PHP - to
the below table output? I can't imagine that I have to work with some
IFs (IF name IS Afghanistan....). Is there any "simple" procedure?
Thanks for any help!
Stef
More information about the thelist
mailing list