Skip to main content
Inspiring
September 27, 2008
Answered

Displaying a query result in 3 columns

  • September 27, 2008
  • 1 reply
  • 607 views
Hi

I have a query with n records. Now I would like to display all records in a HTML page in 3 columns. I don't have a clue on how to do that!

What I would like is (assuming I have 9 records in my query):

<div id="column1">
displaying records 1 to 3
</div>

<div id="column2">
displaying records 4 to 6
</div>

<div id="column3">
displaying records 7 to 9
</div>

Has anyone a short solution or at least a link to a sloution. I didn't find anything great yet...

Thank you & regards
This topic has been closed for replies.
Correct answer tomtomtom7147938
Hi

I found a solution which works fine - unfortunately I don't really understand it :-)

Thank you for your inputs!

1 reply

Participating Frequently
September 28, 2008
Try this

I loop throught td's and when i get my 3 count i end off with a tr and start a new tr

Enjoy,
Ernie
Inspiring
September 28, 2008
Unfortunately your solution doesn't satisfy me 100%ly. I think I would need something like a loop in a loop:

<cfloop query="myquery1">
<div id="column.myquery1">
<cfloop query="myquery2">
Record: myquery2.record
</cfloop>
</div>
</cfloop>

But this looks like a mess! The first loop should 'appear' 3 times because I want three DIVs being displayed on my HTML page. And then per DIV an 'equal' list of records. Assuming my query contains 9 records so there is 3 per DIV. If there is p.e. 11 records I would like to have
4 records in the first DIV
4 records in the second DIV
3 records in the third DIV

Thanks for hints