It looks like you are inserting a new row, and when you do the cfoutput 
for the query, you are displaying both.

Try using an update, pass the primary key in the form to update the 
correct row

Thanks!
Robert Bailey



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">&nbsp;<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
>
> slaba...@po-box.esu.edu
>
>  
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:316917
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to