I have a query and a list of field/column names. I want to do a sort of double loop - loop through each record in the query, and then loop through the list of field/column names and output each corresponding field. The loops should be something like this:
<table>
<cfoutput query="myQuery">
<tr>
<cfloop list="#cols#" index="col">
<td>?</td>
</cfloop>
</tr>
</cfoutput>
</table>
The problem is what to put where the question mark is... I've tried #myquery[col]#
, but this didn't work. I need to get the variable indicated by the string name in the variable col
... And obviously, #col#
will just return the column name. I need to figure out some way to double-evaluate the string... something like ##col##
, which of course won't work either. How can I accomplish this?