-I query my database for the regular data (not for the drop-down)
-I have 10 records per page. Each record is actually a form which can be used to update that record.
-In each form, there needs to be this dynamic drop-down I'm talking about, so it can be individually set for each record.
I know how to query and output data, but I don't seem to be able to output a query within another output of a query. So (if any of that made sense :), how can I do this?
Thank you...
-Matt
<body>
Or similar to the answer below: with thanks to 4midori
<query name=my" datasource="thisdb">
select * from myTable
</cfquery>
<cfquery name="GetInterestCodes" >
select * from myOthertableTable (or the same,but using different criteria, you can even use the same query above using a filter for the choices if this is what you need)
</cfquery>
<FORM action="gonowhere" method="Post">
<CFoutput query="my">
(the out put you need)
<select name="InterestCode" (Multiple?)>
<cfloop query="GetInterestedCodes">
<CFIF GetInterestCodes.InterestID <!--- (the link ID field connecting the two outputs) ---> IS my.InterestID>
<option value="#GetInterestCodes.InterestID#">#GetInterestCodes.InterestID# (or other descriptive value)
<CFELSE>
</CFIF>
</cfloop>
</select>
</cfoutput>
<input name="Submit" type="submit" value="go">
</form>
</body>
</html>
But only CFOUTPUT can be used to <CFOUTPUT>#MyVar#</CFOUTPUT>
If I've already started a CFOUTPUT for something, but I need to loop through something inside that, I used CFLOOP.
Of course you can also used CFLOOP in other ways, like looping through a list:
<CFLOOP from="1" to="#ListLen(MyList)#" index="i">
(I think "ListLen" is valid, if not its another term.)
Ben Seigel | Web Developer
University of WI-Extension
</CFIF>
<!--- inyour code you just call the query output w/o hitting the database. if it times out it will just run before you call the output.--->