Entries Tagged as '<CFLOOP>'

Displaying a Query inside a Query with CFLOOP

<CFLOOP> No Comments »

This is really simple, but I do it all the time: looping through a query because you can’t nest query-driven <cfoutput>.  The pattern is queryname.fieldname[x], and that’s all you really have to remember.

Here’s an example:

<cfoutput query=”myFirstQuery”>

#fieldFromMyFirstQuery#<br />

[[ Insert Second Query Here ]]

<cfif #mySecondQuery.recordCount# GT 0>

<cfloop from=”1” to=”mySecondQuery.recordCount#” index=”thisRecord”>

#mySecondQuery.fieldFromMySecondQuery[thisRecord]#<br />

</cfloop>

</cfoutput>


 

Powered by Mango Blog. Initial Template Design and Icons by N.Design Studio, modified by Michael Cummins.
RSS Feeds