Forum Moderators: coopster

Message Too Old, No Replies

displaying query output in rows instead of columns

mysql query output format

         

ksugam

8:58 pm on Jan 8, 2008 (gmt 0)

10+ Year Member



hello,
Consider a table as
month data1 data2 data3
jan 10 20 30
feb 15 10 70
mar 6 50 100

when i do "select * from table", the output will look same as above.

I need the output row wise, i.e.,

month jan feb mar
data1 10 15 6
data2 20 10 50
data3 30 70 100

can we do this?

jatar_k

9:08 pm on Jan 8, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



the output is up to you

issue your select, then pull the results into an array instead of outputting them directly

then you can output them however you want

another way to show what you want, once your data is in an array would be

month array[0][0] array[1][0] array[2][0]
data1 array[0][1] array[1][1] array[2][1]
data2 array[0][2] array[1][2] array[2][2]
data3 array[0][3] array[1][3] array[2][3]