Joe how do I show these results to the user on the page.

I don't want to do an alert but write them to the page.


>If you want them all to be accessible individually, you can build
>them all out as an array of associative arrays:
>
><!--- Fake query --->
><cfset myQuery = queryNew("contactId,firstname,lastname") />
><cfset queryAddRow(myQuery) />
><cfset querySetCell(myQuery, "contactId", 1, 1) />
><cfset querySetCell(myQuery, "firstname", "Jimi", 1) />
><cfset querySetCell(myQuery, "lastname", "Hendrix", 1) />
><cfset queryAddRow(myQuery) />
><cfset querySetCell(myQuery, "contactId", 2, 2) />
><cfset querySetCell(myQuery, "firstname", "Joe", 2) />
><cfset querySetCell(myQuery, "lastname", "Satriani", 2) />
>
><!--- Output as JS array --->
><cfoutput>
><script>
>var guitarPlayers = [];
>
><cfloop query="myQuery">
>       <cfsilent>
>               <cfset player = "{" />
>               <cfloop list="#myQuery.columnList#" index="column">
>                       <cfset player = player & lCase(column) & ":""" & 
> myQuery[column]
>[myQuery.currentRow] & """" />
>                       <cfif column neq listLast(myQuery.columnList)>
>                               <cfset player = player & "," />
>                       </cfif>
>               </cfloop>
>               <cfset player = player & "}" />
>       </cfsilent>
>       guitarPlayers[guitarPlayers.length] = #player#;
></cfloop>      
>
>alert(guitarPlayers);
>alert(guitarPlayers[0].firstname);
></script>
></cfoutput>
>
>You can also use <cfwddx> to automatically change the query into a JS
>variable.
>
>-Joe

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & 
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:2701
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to