PDA

View Full Version : columnar data -> table


bryndyment
03-30-2003, 03:03 AM
Hi,

I've retrieved some values from a DB, and want to display them in a table. The data is sorted alphabetically in an array, and I want the results to appear as follows (two columns):

A   F
B   G
C   H
D   I
E   J

I want each value to be in its own cell. What's a good programmatic way to build a table, since it kinda wants me to finish each ROW in its entirety before moving on? (Wheras I want to build the <td> for "A", then for "B", since I'm iterating through my loop... it would be hard to build the <td> for "A", then for "F", then for "B"... etc.)

In other words, it would be trivial to contruct the following:

A&nbsp;&nbsp;&nbsp;B
C&nbsp;&nbsp;&nbsp;D
E&nbsp;&nbsp;&nbsp;F
G&nbsp;&nbsp;&nbsp;H
I&nbsp;&nbsp;&nbsp;J

But what's a cool way to build a column-centric table, rather than row-centric?

Hope I've described it well (enough).