> I have a pre-filled form for users to change a record.
> The form calls an action page to update the record.
> I keep getting the dreaded error:
Another problem you might run into is apostrophies in your fields - if
someone enters one in their entries, then your SQL will spit
I'd personally change each of the '#form.fieldname#' to
'#replace(form.fieldname,"'","''","all")#'
Or to save time/coding
<CFQUERY NAME="qDoUpdate" DATASOURCE="teleconference">
UPDATE data
SET
<cfset myCounter=0>
<cfloop index="i"
list="Conf_Name,Conf_Purpose,Conf_Date,Occurance,Begin_Time,End_Time,Mod_Nam
e,Mod_Phone,POC_Name,POC_Phone,Facilities,Comments">
<cfset myCounter=myCounter+1>
<cfif myCounter gt 1>
,
</cfif>
#i#='#Replace(Evaluate("form.#i#"),"'","''","all")#'
</cfloop>
WHERE ID = #Form.ID#
</CFQUERY>
No additional whitespace as it's all in the query, and it'll be easier for
you to update your code - although you may have to do a switch if certain
fields are to be written as different types
If you don't like CFLoop List then you could always do;
<cfset
myArray=ListToArray("Conf_Name,Conf_Purpose,Conf_Date,Occurance,Begin_Time,E
nd_Time,Mod_Name,Mod_Phone,POC_Name,POC_Phone,Facilities,Comments")>
<cfloop index="i" from=1 to="#ArrayLen(myArray)#">
<cfif i gt 1>
,
</cfif>
#myArray[i]#='#Replace(Evaluate("form.#myArray[i]#"),"'","''","all")#'
</cfloop>
HTH
Philip Arnold
Director
Certified ColdFusion Developer
ASP Multimedia Limited
T: +44 (0)20 8680 1133
"Websites for the real world"
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists