[thelist] Cold Fusion -- looping records in 3 columns

Joshua Olson joshua at waetech.com
Fri Feb 28 20:42:01 CST 2003


----- Original Message -----
From: "GravyFace" <gravyface at bmfsquad.com>
Sent: Friday, February 28, 2003 9:16 PM


> without having to write 3 separate queries, is there anyway to continue
> looping the output of a query to three <td>'s (columns)?
> Lets says there are 9 records returned by the query but I want to output 3
> records in the first <td>, 3 in the second, and the last 3 in the third.

Dear Mr. GravyFace,

Here's what I would do.

Take the total record count and divide it by 3.

Output the first 1/3 of the records into a div.  Set it's width to 33% and
float it left.

Output the next 1/3 of the records into a div.  Set it's width to 33% and
float it left.

Output the last 1/3 of the records into a final div.  Set it's width to 33%
and float it left.

That's it.

> Is there anyway to set a record limit condition in the loop?

Most scripting languages let you loop through the recordsets manually.  What
platform/language are you on?

-joshua




More information about the thelist mailing list