Jump to content

Archived

This topic is now archived and is closed to further replies.

yarub

Make Query Start New Row After Three Columns?

Recommended Posts

I'm trying to make it so that if I pull thirty rows from a database, they they go into three columns. However, I want them to begin a new row after they go through a column. I'm really bad at explaining stuff. Let's pretend I have thirty rows with incrementive numbers from one to thirty. I want it to do this when it pulls from the database:

01 02 03
04 05 06
07 08 09
10 11 12
13 14 15
16 17 18
19 20 21
22 23 24
25 26 27
28 29 30

Does that make sense? I want a maximum of three columns. The more rows there are in the database, the more rows that would need to be made in the output. Can anyone direct me in the right way?

Share this post


Link to post
Share on other sites
This is a layout issue... deal with it in PHP.

Share this post


Link to post
Share on other sites
I don't understand why it'd be a layout issue. It would require queries, would it not?

I'm not looking for just the cosmetics part of it. I want to know how to do it all. The query and all.

Share this post


Link to post
Share on other sites
Because having 3 columns is layout... write a query that retrieves them all, and start a new row after every 3rd value.

Share this post


Link to post
Share on other sites
I have no idea how to do that. >_> The only way I know how to do that would look like:

1 1 1
2 2 2
3 3 3
4 4 4

.. and so on. =(

Share this post


Link to post
Share on other sites
Just keep a count as you iterate though the results... if you're not sure how to do this, create a new thread in the PHP forum.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.