Hello Steve,
Set your table to accept NULL and wrap your cfquery around with a
cfif. This way, you will only run the query if you need to. You will
save unnecessary trips to the database if there is no value being passed
by the form variable.
Example:
<cfparam name="FORM.alert" default="" />
<cfif len(FORM.alert)>
<cfquery name="qryUpdate" datasource="text">
update alert set
alert = '#FORM.alert#'
where alert = '#FORM.alert#'
</cfquery>
<cflocation url="../../status1.cfm?msg=succeed.">
<cfelse>
<cflocation url="../../status1.cfm?msg=fail.">
</cfif>
Also, make sure your method is set to POST on your form in order for the
form variables to be passed correctly.
Also, your table will not update if alert is not equal to FORM.alert.
Ravi Gehlot.
Steve LaBadie wrote:
> Is this correct? I am not getting any errors, but the updated text is
> not showing on the page.
>
> <cfquery datasource="text">
> UPDATE alert
> SET alert = '<cfif IsDefined("FORM.alert") AND #FORM.alert# NEQ "">'
> WHERE alert = '#FORM.alert#';
> <cfelse>
> NULL
> </cfif>
> </cfquery>
> <cflocation url="../../status1.cfm?msg=Alert+Title+added+successfully.">
> </cfif>
>
> Steve LaBadie, Web Manager
> East Stroudsburg University
> 200 Prospect St.
> East Stroudsburg, Pa 18301
> 570-422-3999
> http://www.esu.edu
> [email protected]
> -----Original Message-----
> From: Ravi Gehlot [mailto:[email protected]]
> Sent: Thursday, December 18, 2008 1:59 PM
> To: cf-talk
> Subject: Re: Simply Amin Panel
>
> Hello Steve,
>
> You want to update and not insert if you want to replace the text.
>
> Good Luck,
> Ravi Gehlot.
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316928
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4