I think Evaluate() is what you need ;-)
What you SQL says now is "update that field with the value of "FORM.Answer" with the row number appended on the end. What I think you are after is the value of FORM.Answer1....FORM.Answer2, FORM.Answer3 and so on <cfset MyFieldName = "FORM.Answer" & i> <cfset MyFieldValue= Evaluate(MyFieldName)> SET answer = '#MyFieldValue#' HTH Cheers Bryan Stevenson B.Comm. VP & Director of E-Commerce Development Electric Edge Systems Group Inc. phone: 250.480.0642 fax: 250.480.1264 cell: 250.920.8830 e-mail: [EMAIL PROTECTED] web: www.electricedgesystems.com ----- Original Message ----- From: "Stuart Kidd" <[EMAIL PROTECTED]> To: "CF-Talk" <cf-talk@houseoffusion.com> Sent: Thursday, April 21, 2005 12:45 PM Subject: More hash on the mailing list > Hi guys, > > I've got a problem whereby I'm trying to reference my looped variable in > an > SQL statement. > > <!-- Update the answers in the database --> > <cfloop index="i" from="1" to="#CheckQuestions.recordCount#"> > <cfquery name="UpdateAnswers" datasource="user020"> > UPDATE tbl_020publicQuestions > SET answer = '#form.answer##i#' > WHERE interviewID = #CheckInterview.interviewID[i]# > </cfquery> > </cfloop> > > > My problem appears to be the line SET answer = '#form.answer##i#' - any > ideas how I can get this to work? In my form I had answers put into a loop > (answer1 answer2 answer3 etc). > > Thanks, > > Saturday > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:203895 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54