문제

I am trying to reference a query from an array and use it in a cfloop tag and I keep getting an error

Error:

The expression has requested a variable or an intermediate expression result as a simple value. However, the result cannot be converted to a simple value. Simple values are strings, numbers, boolean values, and date/time values. Queries, arrays, and COM objects are examples of complex values.

The most likely cause of the error is that you tried to use a complex value as a simple one. For example, you tried to use a query variable in a cfif tag.

Code:

<cfquery datasource="datasource" name="valueQuery">SELECT count FROM watermelons</cfquery>
<cfset queryArray = ArrayNew(1)>

<cfscript>
ArrayAppend(queryArray, valueQuery);
</cfscript>

<cfloop query="#queryArray[1]#">
        <!---do stuff--->
</cfloop>

I have also tried (without the pounds):

<cfloop query="queryArray[1]">
            <!---do stuff--->
</cfloop>

which gives this error:

The value of the attribute query, which is currently queryArray[1], is invalid.

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top