Excuse this line of my code snippet.  It was just for debugging and I forgot
to pull it out.  
<cfset rem = idx MOD 6 />

Same principle will apply to iterating a query rather than a loop.  Just use
mod with the currentrow variable.

Hope that helps.

----------------
Curtis C. Layton
Senior Web Applications Developer - AboutWeb, LLC - http://www.aboutweb.com
Blog: http://www.curtislayton.com
Adobe Certified Advanced ColdFusion MX Developer



-----Original Message-----
From: Curt Layton [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 05, 2007 3:07 PM
To: CF-Newbie
Subject: RE: create dynamic table with max columns

I think you want to use the mod operator. Is this what you're trying to
accomplish?

<table border="1">
<tr>
<cfloop from="0" to="11" index="idx">
        <cfset rem = idx MOD 6 />
        
        <cfif idx MOD 5 EQ 0>
                </tr><tr>
        </cfif>
                <td>col</td>
</cfloop>
</tr>
</table>


-----Original Message-----
From: richard groen [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 05, 2007 2:57 PM
To: CF-Newbie
Subject: create dynamic table with max columns

Hi all,

I got one brainteaser (well...for me).

I have a database with, lets say 100 images, these images are 'dynamic' e.g.
it can be 100 but also 151 images. 

My question is:
How can i make a dynamic table where I can set that the maximum columns to
5. So when parsing the images (generating the query output), then the
function fills up a one row with 5 images (all in a different column) and
the 6th image is at a new row etc. etc.

I just cant figure it out.
Hope you can help! thanks in advance.

Grt,
Richard 





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Enterprise web applications, build robust, secure 
scalable apps today - Try it now ColdFusion Today
ColdFusion 8 beta - Build next generation apps

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3032
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to