Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping through query fields

Status
Not open for further replies.

sevex

Programmer
Sep 18, 2001
74
CA
I have a query with quite a few fields, and I want to loop through them to do additional queries to get specific values from each.

Is there any way to loop through query fields like looping through form fields in a collection?

Any help would be greatly appreciated!

(anyone else notice that the documentation that comes with coldfusion is severely lacking?)
 
this serves me well:

<cfloop query=&quot;qQueryName&quot;>
<cfif fieldNameID EQ 10>
<cfset variables.qID= CurrentRow>
</cfif>
</cfloop>


<cfoutput>#qQueryName.anotherField[variables.qID]#</cfoutput> Sylvano
dsylvano@hotmail.com
 
if you have a query like this:

<CFquery name=&quot;testQuery&quot;>
SELECT *
FROM TABLE
</cfquery>

one of the variables that is returned is called columnlist

you can loop over this by using:

<CFLOOP list=&quot;testQuery.ColumnList&quot; index=&quot;i&quot;>
<cfoutput>
#i#<BR>
</cfoutput>
</cfloop>

hope this helps !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top