Hello Steve,
You want to update and not insert if you want to replace the text.
Good Luck,
Ravi Gehlot.
Steve LaBadie wrote:
> I created a simple (I thought) admin panel to update specific text on a
> page. But to my surprise when I update the text it adds it at the end
> instead of replacing the existing text. Not sure what I need to do so it
> adds and deletes existing text.
>
>
>
> This is the panel code:
>
>
>
> <cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
>
> <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ
> "frmAddAlert">
>
> <cfquery datasource="text">
>
> INSERT INTO alert (alert)
>
> VALUES (
>
> <cfif IsDefined("FORM.alert") AND #FORM.alert# NEQ "">
>
> '#FORM.alert#'
>
> <cfelse>
>
> NULL
>
> </cfif>
>
> )
>
> </cfquery>
>
> <cflocation url="../../status1.cfm?msg=Alert+Title+added+successfully.">
>
> </cfif>
>
>
>
> <form action="<cfoutput>#CurrentPage#</cfoutput>" method="post"
> name="frmalert" id="frmAddAlert">
>
> <textarea name="alert" cols="70" rows="10" id="alert"
> class="formveld"></textarea>
>
> <input name="Reset" type="reset" id="Reset" value=" Reset "
> class="formveld"> <input name="Submit" type="submit" id="Submit"
> value=" Submit " class="formveld">
>
>
>
> <input type="hidden" name="MM_InsertRecord" value="frmAddAlert">
>
> </form>
>
>
>
>
>
> This is the insertion page code:
>
>
>
> <cfquery name="GetAlert" datasource="text">
>
> SELECT *
>
> FROM alert
>
> </cfquery>
>
> <cfoutput query="GetAlert">#GetAlert.alert#</cfoutput>
>
>
>
>
>
> Steve LaBadie, Web Manager
>
> East Stroudsburg University
>
> 200 Prospect St.
>
> East Stroudsburg, Pa 18301
>
> 570-422-3999
>
> http://www.esu.edu
>
> [email protected]
>
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:316916
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4