Page 1 of 1

Outputting DB results in Column/Rows not just rows

Posted: Fri Oct 24, 2003 12:39 pm
by EverToDesign
Hey there, got a question.

Usually when I output results its with a echo in a while loop that adds a new row constantly to the table.

However now I need it to output it so that theres records going across 3 columns and repeating down.

So instead of an HTML Table that outputs rows like

Record1
Record2
Record3
Record4
Record5
Record6

it'd be output as

Record1 Record2 Record3
Record4 Record5 Record6
Record7 Record8 Record9

in a table.

Anyone able to tell me how i'd go about on this?

Posted: Fri Oct 24, 2003 12:50 pm
by Johnm
You can put it in a loop and use modulus on the loop counter to determin when to echo out a </tr><tr> to create a new row.


John M

Posted: Fri Oct 24, 2003 12:51 pm
by Gen-ik
Think about how the <table> needs to be built and then think about what you will need to do in your PHP loop.

This is a really easy problem to solve if you just sit down for 2 minutes and think about it.