Can anyone help??

Hi - this has got to be an easy fix.  I've got a dynamic form sending a
dynamic amount of fields to a Query.  The form fields Level#i#  are radio
buttons.  Here's the code:

<cfloop index="i" from="1" to="#x#">
 <cfset thisskillid = Evaluate("Skillid"&i)>
 <cfset thislevel = Evaluate("level" & i)>
 <cfset thisempid = #empid#>

 <cfquery name="getanswer" datasource="personnel">
  SELECT empid, skillid
  FROM tblMatrix
  WHERE empid=#thisempid# and skillid=#thisskillid#
 </cfquery>
 <cfif #getanswer.recordcount# is 0>
 <cfquery name="insertrow" datasource="personnel">
  INSERT INTO tblMatrix (empid, skillid, skilllevel) VALUES (#empid#,
#thisskillid#, #thislevel#)
 </cfquery>
 <cfelse>
 <cfquery name="updaterow" datasource="personnel">
  UPDATE tblMatrix
   SET skilllevel=#thislevel#
   WHERE empid=#thisempid# AND skillid=#thisskillid#
 </cfquery>
 </cfif>
</cfloop>

The problem is that if the the user doesn't answer that particular question,
say they don't answer the first question - then this is the error:

An error occurred while evaluating the expression:


 thislevel = Evaluate("level" & i)



Error near line 12, column 8.
----------------------------------------------------------------------------
----

An error has occurred while processing the expression:

   level1


Error near line 1, column 1.


----------------------------------------------------------------------------
----

Error resolving parameter LEVEL1


Okay, so how do I <cfset Level#i# = "">??  That snippet gives me an "Invalid
Parser Construct" error, pointing to the first #.

This has to be easy... its not coming to me and I've wasted far too much
time on this little bit of code.


Erika Foster
engineering-environmental Management
Applications Developer
(505) 866-1654
[EMAIL PROTECTED]


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-community@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to