PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
EverToDesign
Forum Newbie
Posts: 10 Joined: Sat Oct 11, 2003 9:38 am
Post
by EverToDesign » Fri Oct 24, 2003 12:39 pm
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?
Johnm
Forum Contributor
Posts: 344 Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:
Post
by Johnm » Fri Oct 24, 2003 12:50 pm
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
Gen-ik
DevNet Resident
Posts: 1059 Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.
Post
by Gen-ik » Fri Oct 24, 2003 12:51 pm
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.