Originally posted by acoder
Ok so this should be correct?
Code:
<CFIF REQUEST_METHOD EQ "POST"> <!---<CFSET machineListLen = listLen(Form.serialcount)>---> <cfset currSerialNo = 1> <CFLOOP list="#form.serialcount#" index="machineCount"> <cfloop condition="currSerialNo neq machinecount"> <cfquery name="deleteserialparts" datasource="CustomerSupport"> exec usp_CS_Deleteserialparts <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">, '#Form.pk_ticketID#' </cfquery> </cfloop> </cfif> <CFSET serialnum = Form["serialnum_" & machineCount]> <CFSET modelno = Form["modelno_" & machineCount]> <CFSET producttype = Form["producttype_" & machineCount]> <CFSET softhardware = Form["softhardware_" & machineCount]> <CFSET resolution = Form["resolution_" & machineCount]> <CFSET resdate = Form["resdate_" & machineCount]> <CFSET resvertified = Form["resvertified_" & machineCount]> <CFSET vertifidate = Form["vertifidate_" & machineCount]> <CFSET deptvendor = Form["deptvendor_" & machinecount]> <CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]> <CFSET thedescription = Form["thedescription_" & machineCount]> <!--- inserts information into the serial table---> <cfquery name="serialinsertupdate" datasource="CustomerSupport"> exec usp_CS_Updateinsertserial <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">, "#Form.pk_ticketID#", <cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">, <cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">, <cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">, <cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">, <cfqueryparam value="#resdate#">, <cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">, <cfqueryparam value="#vertifidate#">, <cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">, <cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR"> </cfquery> <!---Inserts information into notes_descr table.---> <cfquery name="description" datasource="CustomerSupport"> exec usp_CS_Insertdescription <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">, '#Form.pk_ticketID#', <cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">, '#Form.fk_addedBy#' </cfquery> <!---Inserts parts information into parts table.---> <!---because it is a bit we don't use 'ticks' around defective for parts table---> <cfparam name="form.partcounter#machinecount#" default=""> <cfloop list="#form['partscount' & machinecount]#" index="ps"> <cfparam name="Form.defective_#ps#_#machinecount#" default="0"> <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0"> <CFSET hcpn = Form["hcpn_" & "#ps#" & "_#machinecount#"]> <CFSET partsreturn = Form["partsreturn_" & "#ps#" & "_#machinecount#"]> <CFSET defective = Form["defective_" & "#ps#" & "_#machinecount#"]> <CFSET rma = Form["rma_" & "#ps#" & "_#machineCount#"]> <cfquery name="parts" datasource="CustomerSupport"> exec usp_CS_Updateinsertparts <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">, '#Form.pk_ticketID#', <cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">, <cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">, <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">, <cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT"> </cfquery> </cfloop> <cfset currSerialNo = currSerialNo + 1> </CFLOOP> </CFIF>
Rach
Comment