Guest_imported
New member
- Jan 1, 1970
- 0
Hello,
Can somebody please help me?
This may sound real stupid but
I have a query in which my SELECT elements are in a list
How Can I output exactly those list elements from my query, since i don't know which fields are in the list and i can't just put my list between output tags.
I tried looping with arays and stuff
Here's my code:
<cfquery name="qGetViews" datasource="datasource" dbtype="ODBD" maxrows="1">
SELECT #Session.Primarykey# AS Primarykey,
<cfset QuerElements = #Session.ViewFields#>
<cfloop from="1" to="#ListLen(Session.ViewFields)#" index="counter">
<cfset Session.aQuElements[teller] = #ListFirst(QuerElements)#>
<cfset QuerElements = #ListRest(QuerElements)#>
#Session.aQuElements[teller]# AS GetField#teller# <cfif teller lt #ListLen(Session.FormVeldenZien)#>,</cfif>
</cfloop>
FROM tablename
ORDER BY #Session.Primkey# DESC
</cfquery>
Now if the list Session.ViewFields contains 3 elements
I want to dynamicly output Getfield1,Getfield2 and Getfield3,
but i can't do this in a loop .
Please Help
tnx
Can somebody please help me?
This may sound real stupid but
I have a query in which my SELECT elements are in a list
How Can I output exactly those list elements from my query, since i don't know which fields are in the list and i can't just put my list between output tags.
I tried looping with arays and stuff
Here's my code:
<cfquery name="qGetViews" datasource="datasource" dbtype="ODBD" maxrows="1">
SELECT #Session.Primarykey# AS Primarykey,
<cfset QuerElements = #Session.ViewFields#>
<cfloop from="1" to="#ListLen(Session.ViewFields)#" index="counter">
<cfset Session.aQuElements[teller] = #ListFirst(QuerElements)#>
<cfset QuerElements = #ListRest(QuerElements)#>
#Session.aQuElements[teller]# AS GetField#teller# <cfif teller lt #ListLen(Session.FormVeldenZien)#>,</cfif>
</cfloop>
FROM tablename
ORDER BY #Session.Primkey# DESC
</cfquery>
Now if the list Session.ViewFields contains 3 elements
I want to dynamicly output Getfield1,Getfield2 and Getfield3,
but i can't do this in a loop .
Please Help
tnx