dynamic - How can I access the query for my cfoutput dynamically, based on a query name variable? -
i have struct contains 2 queries. have variable "key" of 1 of queries, , want output query dynamically using variable. basic code:
<cfquery name="myqueries.names" ... >...</cfquery> <cfquery name="myqueries.places" ... >...</cfquery> <cfset queryname = "places" /> <cfoutput query="myqueries[queryname]"> ... </cfoutput>
this gives me error attribute validation error tag cfoutput.
the cfoutput "query" attribute doesn't seem support bracket notation. how can access query cfoutput?
the query attribute of cfoutput requires valid variable name, can set intermediary value , use reference query
<cfset realquery = myqueries[queryname]> <cfoutput query="realquery"> ... </cfoutput>
Comments
Post a Comment