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!
I can't figure out a bit of a problem that I think should be pretty simple.
I have a mysql atabase that contains a list of users, what I want to do is when the users are pulled from the database each user is displayed in a seperate column (up to 4 columns wide) and if there is more than 4 users then it starts a new row of them.
I know how to display the users all under each other 1 at a time but am struggling to figur eout gettign them to be displayed in the columns how I want them to be.
Is anyone able to help.
This is how I have it at the moment so it displays the users in their own rows.
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Put a 'counter' in it. Start with a variable and then count up until you reach your number, at which point you start a new row.
I've put this inside a do/while loop for the example and we will assume that your mysql_query is held in a variable called $sql:
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]