Temporarily replace your CFQUERY tags with CFOUTPUT tags, then submit it and
see how it resolves (outputs) to the action page.  That way, you can see
exactly what you are trying to process and more easily spot errors.



----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: "CF-Newbie" <[email protected]>
Sent: Wednesday, June 08, 2005 10:31 AM
Subject: Update dilemma


>
> Hi,
>
> I'm a complete newbie at Coldfusion, and have a pretty basic  question.
>
> I'm trying to get an update page working, and it keeps returning the
error:
>
>
> Error  Executing Database Query.
> Syntax error in UPDATE  statement.     The error occurred in
> C:\CFusionMX7\wwwroot\CFIDE\gettingstarted\tutorial\update2.cfm: line  65
> 63 :       NULL
>
> 64 :   </cfif>
>
> 65 :   WHERE ID=#FORM.hiddenField#
>
> 66 :   </cfquery>
>
> 67 : </cfif>
>
>
> Here is the code I have written for it...
>
> <cfparam name="URL.recordID" default="1">
> <cfset  CurrentPage=GetFileFromPath(GetTemplatePath())>
> <cfif  IsDefined("FORM.MM_UpdateRecord") AND FORM.MM_UpdateRecord EQ
"form1">
> <cfquery datasource="artists">
> UPDATE  Sheet1 SET Name=
> <cfif IsDefined("FORM.name") AND #FORM.name# NEQ  "">
> '#FORM.name#'
> <cfelse>
> NULL
> </cfif>
> , Surname=
> <cfif IsDefined("FORM.surname")  AND #FORM.surname# NEQ "">
> '#FORM.surname#'
> <cfelse>
> NULL
> </cfif>
> , Sex=
> <cfif IsDefined("FORM.sex") AND  #FORM.sex# NEQ "">
> '#FORM.sex#'
> <cfelse>
> NULL
> </cfif>
> , Height=
> <cfif IsDefined("FORM.height")  AND #FORM.height# NEQ "">
> '#FORM.height#'
> <cfelse>
> NULL
> </cfif>
> , Playing_age=
> <cfif  IsDefined("FORM.playing_age") AND #FORM.playing_age# NEQ  "">
> '#FORM.playing_age#'
> <cfelse>
> NULL
> </cfif>
> , DOB=
> <cfif IsDefined("FORM.DOB") AND  #FORM.DOB# NEQ "">
> '#FORM.DOB#'
> <cfelse>
> NULL
> </cfif>
> , Hair=
> <cfif IsDefined("FORM.Hair") AND  #FORM.Hair# NEQ "">
> '#FORM.Hair#'
> <cfelse>
> NULL
> </cfif>
> , Eye=
> <cfif IsDefined("FORM.eye") AND  #FORM.eye# NEQ "">
> '#FORM.eye#'
> <cfelse>
> NULL
> </cfif>
> , Image=
> <cfif IsDefined("FORM.Image") AND  #FORM.Image# NEQ "">
> '#FORM.Image#'
> <cfelse>
> NULL
> </cfif>
> , Training=
> <cfif  IsDefined("FORM.training") AND #FORM.training# NEQ "">
> '#FORM.training#'
> <cfelse>
> NULL
> </cfif>
> WHERE ID=#FORM.hiddenField#
> </cfquery>
> </cfif>
> <cfquery name="update"  datasource="artists">
> SELECT *
> FROM Sheet1
> WHERE ID = #URL.recordID#
> </cfquery>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01  Transitional//EN"
> "_http://www.w3.org/TR/html4/loose.dtd_
(http://www.w3.org/TR/html4/loose.dtd) ">
> <html>
> <head>
> <meta  http-equiv="Content-Type" content="text/html;  charset=iso-8859-1">
> <title>Untitled  Document</title>
> </head>
>
> <body>
> <form  action="<cfoutput>#CurrentPage#</cfoutput>" name="form1"
> method="POST">
> <input name="hiddenField" type="hidden"
> value="<cfoutput>#update.ID#</cfoutput>">
> <input  name="name" type="text" id="name"
> value="<cfoutput>#update.Name#</cfoutput>">
> <input  value="<cfoutput>#update.Surname#</cfoutput>" name="surname"
> type="text" id="surname">
> <input  value="<cfoutput>#update.Sex#</cfoutput>" name="sex" type="text"
> id="sex">
> <input name="height" type="text" id="height"
> value="<cfoutput>#update.Height#</cfoutput>">
> <input  value="<cfoutput>#update.Playing_age#</cfoutput>"
name="playing_age"
> type="text" id="playing_age">
> <input  value="<cfoutput>#update.DOB#</cfoutput>" name="DOB" type="text"
> id="DOB">
> <input  value="<cfoutput>#update.Hair#</cfoutput>" name="Hair" type="text"
> id="Hair">
> <input  value="<cfoutput>#update.Eye#</cfoutput>" name="eye" type="text"
> id="eye">
> <input  value="<cfoutput>#update.Image#</cfoutput>" name="Image"
type="text"
> id="Image">
> <input  value="<cfoutput>#update.Training#</cfoutput>" name="training"
> type="text" id="training">
> <input type="submit" name="Submit"  value="Submit">
> <input type="hidden" name="MM_UpdateRecord"  value="form1">
> </form>
> </body>
> </html>
>
> Any ideas?
>
> Please reply to [EMAIL PROTECTED] (mailto:[EMAIL PROTECTED])
>
> Thanks guys,
>
> Dan
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:15:1100
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to