all groups > coldfusion flash integration > november 2006 >
You're in the

coldfusion flash integration

group:

Cold Fusion Dynamic field names


Cold Fusion Dynamic field names dondalinger
11/8/2006 7:47:21 PM
coldfusion flash integration: Hello, thanks for reading...

what I'm trying to do is below and it works...

<cfquery name="updateans" datasource="database">
UPDATE Participants
SET sect1answer1 ='#flash.answergiven#'
WHERE PartID = #flash.login#
</cfquery>

but I want to reuse this query for several fields so I'm trying to do this:

<cfquery name="updateans" datasource="database">
UPDATE Participants
SET ('#flash.which#') ='#flash.answergiven#'
WHERE PartID = #flash.login#
</cfquery>

This does not work, I've tried evaluate and cfset but neither one seems to be
the solution, any one know what the syntax is?

THanks!!!
Re: Cold Fusion Dynamic field names Joe Zack
11/19/2006 7:21:50 PM
Assuming that flash.which and flash.answergiven are comma delimited
lists and contain the same number of elements then you should be able
to do something like this...



<cfquery name="updateans" datasource="database">
<cfloop from="1" to="#listLen(flash.which)#" index="i">
UPDATE Participants
SET #ListGetAt(flash.which,i)# =
'#ListGetAt(flash.answergiven,i)#'
WHERE PartID = #flash.login#
</cfloop>
</cfquery>


[quoted text, click to view]
AddThis Social Bookmark Button