Newbie display two columns

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

Post Reply
rzen
Forum Newbie
Posts: 2
Joined: Sun Apr 06, 2008 7:53 pm

Newbie display two columns

Post by rzen »

Hi. I would like to know where i can find materials or tutorials regarding this specific issue.
I want the output from my database to be displayed in two columns, where each of the displayed results will have the picture, title and the content (all of them are stored in the database). I have managed to display one record per row, but i think it will be more practical to show two articles(products or whatever) per row. Its a little frustrating because all the websites I'm analyzing are using this kind of display and I don't know how to do it and I can't find how is this done.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Newbie display two columns

Post by Christopher »

The concept is that you have an integer counter variable that you increment at the end of each loop. In the loop you check to see if the counter is equal to the number of columns you want. If it is you start a new row and set the counter back to its start value (e.g. 1).
(#10850)
rzen
Forum Newbie
Posts: 2
Joined: Sun Apr 06, 2008 7:53 pm

Re: Newbie display two columns

Post by rzen »

Thanks a lot for the answer! It helped :D
Post Reply