Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

For Darkman 1

Status
Not open for further replies.

programmher

Programmer
May 25, 2000
235
US
(Darkman,<br><br>I have been unsuccessful in my attempts to update records in my database.&nbsp;&nbsp;If you have time, please peruse my code and tell me where my errors lie.&nbsp;&nbsp;(Disregard the quotation marks at the beginning and end of this code.):<br><br>“FORM ONE:&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;&gt;<br><br>&lt;html&gt;<br>&lt;head&gt;<br> &lt;title&gt;Input&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; background=&quot;Cnrclogo.gif&quot; bgcolor=&quot;Blue&quot;&gt;<br>&lt;tr&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;&lt;IMG alt=&quot;&quot; border=0 height=95 src=&quot;Cnrclogo.gif&quot; width=103&gt;&lt;/td&gt; <br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;td style=&quot;color: Navy;&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&lt;td style=&quot;color: Navy;&quot;&gt;&lt;/td&gt; <br> &lt;/tr&gt;<br>&lt;/table&gt;<br>&lt;/head&gt;<br><br>&lt;h1 align=&quot;CENTER&quot; style=&quot;font-size: large; font-family: sans-serif; color: Navy;&quot; title=&quot;EXPENSES&quot;&gt;Input&lt;/h1&gt;<br>&lt;marquee title=&quot;&quot; height=&quot;3%&quot; width=&quot;747&quot; style=&quot;font-family: Times New Roman; font-size: small; color: Navy;&quot; scrollamount=&quot;5&quot; border=&quot;1&quot;&gt;<br>              <br>COMPLY!  Resistance is FUTILE...  &nbsp;&nbsp;&nbsp;<br>&lt;/marquee&gt;<br><br>&lt;cfform action=&quot;TestFormTwo.cfm&quot; method=&quot;POST&quot;&gt;<br><br>&nbsp;&lt;th&gt;&lt;Font size=-5&gt;Name:&lt;/th&gt;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;&lt;cfinput Type = &quot;text&quot;<br> name = &quot;Name&quot;<br> maxlength=&quot;25&quot; required=&quot;yes&quot; message=&quot;Last Name is a required field!&quot;<br> Size = &quot;25&quot;&gt;&lt;/font&gt;&lt;/td&gt;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;City:&lt;/th&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;&lt;cfinput Type = &quot;Text&quot;<br> name = &quot;City&quot;<br> maxlength=&quot;20&quot; required=&quot;yes&quot; message=&quot;City is a required field!&quot;<br> Size = &quot;20&quot;&gt;&lt;/td&gt;<br> <br>&nbsp;&lt;/tr&gt;<br><br>&lt;tr&gt; <br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;State:&lt;/th&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;&lt;cfinput Type = &quot;text&quot;<br> name = &quot;State&quot;<br> maxlength=&quot;2&quot; required=&quot;yes&quot; message=&quot;State is a required field!&quot;<br> Size = &quot;2&quot;&gt;&lt;/td&gt;<br><br><br> <br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;ZIP:&lt;/th&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;&lt;cfinput Type = &quot;text&quot;<br> name = &quot;ZipCode&quot;<br> maxlength=&quot;10&quot; required=&quot;yes&quot; message=&quot; Zip Code is a required field!&quot;<br> Size = &quot;10&quot;&gt;&lt;/td&gt;<br>&lt;/tr&gt; <br>&nbsp;&lt;/table&gt;<br>&lt;p&gt;<br>&lt;p align=&quot;center&quot;&gt;<br> &lt;Input type = &quot;submit&quot; VALUE=&quot;Submit&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;Input type = &quot;reset&quot; VALUE=&quot;Clear Form&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;td align=&quot;middle&quot;&gt;<br> &lt;/A&gt;&lt;/td&gt;&lt;/p&gt;<br>&lt;/cfform&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br>(This form works.)<br><br>FORM TWO<br>&lt;cfinsert datasource=&quot;OPE&quot; tablename=&quot;MyTestTable&quot;&gt; <br>&lt;cfquery name=&quot;EnteredRecord&quot; datasource=&quot;OPE&quot;&gt;<br>SELECT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MAX (ID) AS ID<br>FROM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dbo.MyTestTable<br>&lt;/cfquery&gt;<br><br>&nbsp;&nbsp;&lt;cfquery name=&quot;EditedInfo&quot; datasource=&quot;ope&quot;&gt;<br> Select * FROM MyTestTable<br>&nbsp; Where ID = #EnteredRecord.ID#<br>&lt;/cfquery&gt; <br><br><br>&lt;html&gt;<br>&lt;head&gt;&lt;title&gt;Information&lt;/title&gt;&lt;/head&gt;<br><br><br>&lt;h2 align=&quot;CENTER&quot;&gt;Review/EditInformation&lt;/h2&gt;<br>&lt;h3&gt;This is what you entered:&lt;/h3&gt;<br><br>&lt;cfoutput query=&quot;EditedInfo&quot;&gt;<br>&lt;!--- <br>&nbsp;&lt;/cfoutput&gt;&nbsp;&nbsp;&nbsp;---&gt;<br>&lt;input type=&quot;hidden&quot; name=&quot;ID&quot; value='#ID#'&gt; <br><br>h3 align=&quot;CENTER&quot; style=&quot;color: Navy;&quot;&gt;Below is a review of the entered data:&lt;/h3&gt;<br><br>&lt;table width=&quot;100%&quot; border=&quot;1&quot; cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; align=&quot;CENTER&quot; valign=&quot;MIDDLE&quot;&gt;<br>&lt;tr&gt;<br>&lt;th&gt;Name&lt;/th&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;#Name#&lt;/th&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;City&lt;/th&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;#City#&lt;/td&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;ST&lt;/th&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;#State#&lt;/td&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;ZipCode&lt;/th&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;#ZipCode#&lt;/td&gt;<br>&lt;tr&gt;<br> <br>&lt;/tr&gt;<br>&lt;/table&gt;<br>&lt;h3 style=&quot;font-size: medium; text-align: center; color: Navy;&quot;&gt;THANK YOU - YOUR REQUEST WILL BE PROCESSED!!!&lt;/font&gt;&lt;/h3&gt;<br>&lt;div align=&quot;center&quot;&gt;<br> &lt;td&gt;&lt;a href=TestFormThree.cfm?ID=#ID#&gt;&lt;Font size=-1&gt;[EDIT]&lt;/font&gt;&lt;/a&gt;&lt;/td&gt;<br><br>&lt;/cfoutput&gt; <br><br>&lt;/form&gt;<br>&lt;/html&gt;<br>&lt;/p&gt;&lt;/div&gt; <br><br>(This form works.)<br><br>FORM THREE<br><br><br>&lt;cfquery name=&quot;MoreEditedInfo&quot; datasource=&quot;ope&quot;&gt;<br> Select * FROM MyTestTable<br> Where ID = '#ID#' <br>&lt;/cfquery&gt;<br><br>&lt;html&gt;<br>&lt;head&gt;&lt;title&gt; - Edit Information&lt;/title&gt;&lt;/head&gt;<br>&lt;body bgcolor=&quot;#FFFFFF&quot;&gt;<br><br>&lt;h2 align=&quot;CENTER&quot;&gt;Review/Edit&nbsp;&nbsp;Information&lt;/h2&gt;<br>&lt;h3&gt;This is what you entered:&lt;/h3&gt;<br>&lt;cfoutput query=&quot;MoreEditedInfo&quot;&gt;<br>&lt;Form Action=&quot;ThisLittleFormWorks.cfm&quot; Method=post&gt; <br>&lt;tr&gt;<br><br>&lt;table width=&quot;100%&quot; border=&quot;1&quot; cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; align=&quot;CENTER&quot; valign=&quot;MIDDLE&quot;&gt;&nbsp;&nbsp;<br>&lt;tr&gt;<br>Name<br>&lt;input type=&quot;text&quot; name=&quot;Name&quot; size=15 value=&quot;#Name#&quot;&gt;<br>City<br>&lt;input type=&quot;text&quot; name=&quot;City&quot; size=20 value=&quot;#City#&quot;&gt;<br>State<br>&lt;input type=&quot;text&quot; name=&quot;ST&quot; size=2 value=&quot;#State#&quot;&gt;<br>Zip Code<br>&lt;input type=&quot;text&quot; name=&quot;ZipCode&quot; size=11 value=&quot;#ZipCode#&quot;&gt;<br> &lt;pre&gt; <br> &lt;p align=&quot;center&quot;&gt; <br> &lt;td&gt;&lt;a href=&quot;ThisLittleFormWorks.cfm?ID=#ID#&quot;&gt;&lt;Font size=3&gt;Update Record&lt;/font&gt;&lt;/a&gt;&lt;/td&gt; <br>&lt;/pre&gt;<br>&lt;/form&gt;<br>&lt;tr&gt;&lt;/tr&gt;<br>&lt;!--- &lt;/pre&gt; ---&gt;<br><br>&lt;input type=&quot;hidden&quot; name=&quot;ID&quot; value=&quot;#ID#&quot;&gt;<br> &lt;pre&gt; <br><br><br>&nbsp;&lt;/cfoutput&gt;<br><br>&lt;/form&gt;<br><br>&lt;/body&gt;<br><br><br>&lt;/html&gt;<br><br>(This Form Works)<br><br>LAST FORM - WILL NOT UPDATE DATABASE<br><br>&lt;cfparam name=&quot;Name&quot; default=&quot;&quot;&gt;<br>&lt;cfparam name=&quot;City&quot; default=&quot;&quot;&gt;<br>&lt;cfparam name=&quot;State&quot; default=&quot;&quot;&gt;<br>&lt;cfparam name=&quot;ZipCode&quot; default=&quot;&quot;&gt;<br>&lt;cfquery datasource=&quot;ThisLittleQueryWorked&quot;&gt;<br>UPDATE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MyTestTable<br>SET&nbsp;&nbsp;<br>&nbsp;Name='#Name#',<br>&nbsp;City='#City#',<br>&nbsp;State='#State#',<br>&nbsp;ZipCode='#ZipCode#'<br>WHERE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(ID = '#ID#')<br>&lt;/cfquery&gt;<br>&lt;input type=&quot;hidden&quot; name=&quot;ID&quot; value=&quot;#form.ID#&quot;&gt; <br><br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;Name&lt;/th&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;'#Name#'&lt;/td&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;City&lt;/th&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;'#City#'&lt;/td&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;ST&lt;/th&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;'#ST#'&lt;/td&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;ZipCode&lt;/th&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;'#ZipCode#'&lt;/td&gt;<br>&nbsp;&nbsp;<br>&lt;/tr&gt;<br>&lt;/table&gt;”)<br><br>Thank you in advance!<br><br><br><br><br>
 
<font color=#ff3333>FORM ONE:<br><FONT FACE=monospace><b>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>&nbsp;&nbsp;&lt;title&gt;Input&lt;/title&gt;<br>&lt;/head&gt;<br><br>&lt;body&gt;<br>&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; background=&quot;Cnrclogo.gif&quot; bgcolor=&quot;Blue&quot;&gt;<br>&lt;tr&gt;&lt;td&gt;&lt;IMG alt=&quot;&quot; border=0 height=95 src=&quot;Cnrclogo.gif&quot; width=103&gt;&lt;/td&gt;&lt;/tr&gt;<br>&lt;/table&gt;<br><br>&lt;h1 align=&quot;CENTER&quot; style=&quot;font-size: large; font-family: sans-serif; color: Navy;&quot; title=&quot;EXPENSES&quot;&gt;Input&lt;/h1&gt;<br><br>&lt;marquee title=&quot;&quot; height=&quot;3%&quot; width=&quot;747&quot; style=&quot;font-family: Times New Roman; font-size: small; color: Navy;&quot; scrollamount=&quot;5&quot; border=&quot;1&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>COMPLY!&nbsp;&nbsp;Resistance is FUTILE...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&lt;/marquee&gt;<br><br>&lt;cfform action=&quot;TestFormTwo.cfm&quot; method=&quot;POST&quot;&gt;<br><br>&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; background=&quot;Cnrclogo.gif&quot; bgcolor=&quot;Blue&quot;&gt;<br>&lt;tr&gt;<br>&nbsp;&nbsp;&lt;th&gt;Name:&lt;/th&gt;&nbsp;&nbsp;<br>&nbsp;&nbsp;&lt;td&gt;&lt;cfinput Type = &quot;text&quot;<br>name = &quot;Name&quot;<br>maxlength=&quot;25&quot; required=&quot;yes&quot; message=&quot;Last Name is a required field!&quot;<br>Size = &quot;25&quot;&gt;&lt;/td&gt;<br>&nbsp;&nbsp;&lt;th&gt;City:&lt;/th&gt;<br>&nbsp;&nbsp;&lt;td&gt;&lt;cfinput Type = &quot;Text&quot;<br>name = &quot;City&quot;<br>maxlength=&quot;20&quot; required=&quot;yes&quot; message=&quot;City is a required field!&quot;<br>Size = &quot;20&quot;&gt;&lt;/td&gt;<br>&lt;/tr&gt;<br><br>&lt;tr&gt; <br>&nbsp;&nbsp;&lt;th&gt;State:&lt;/th&gt;<br>&nbsp;&nbsp;&lt;td&gt;&lt;cfinput Type = &quot;text&quot;<br>name = &quot;State&quot;<br>maxlength=&quot;2&quot; required=&quot;yes&quot; message=&quot;State is a required field!&quot;<br>Size = &quot;2&quot;&gt;&lt;/td&gt;<br>&nbsp;&nbsp;&lt;th&gt;ZIP:&lt;/th&gt;<br>&nbsp;&nbsp;&lt;td&gt;&lt;cfinput Type = &quot;text&quot;<br>name = &quot;ZipCode&quot;<br>maxlength=&quot;10&quot; required=&quot;yes&quot; message=&quot; Zip Code is a required field!&quot;<br>Size = &quot;10&quot;&gt;&lt;/td&gt;<br>&lt;/tr&gt; <br>&lt;/table&gt;<br><br>&lt;p align=&quot;center&quot;&gt;<br>&lt;Input type = &quot;submit&quot; VALUE=&quot;Submit&quot;&gt;&lt;Input type = &quot;reset&quot; VALUE=&quot;Clear Form&quot;&gt;<br>&lt;/p&gt;<br>&lt;/cfform&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br></b></font><br><br>There were a few stray tags, so I cleaned it up a bit...<br></font><br><font color=#3333ff><br>FORM TWO<br><FONT FACE=monospace><b><br>&lt;!--- use cftransaction to ensure you're getting the correct id ---&gt;<br>&lt;cftransaction&gt;<br>&nbsp;&nbsp;&lt;cfquery name=&quot;Insert&quot; datasource=&quot;OPE&quot;&gt;<br>&nbsp;&nbsp;insert into MyTestTable (Name,City,State,ZipCode)<br>&nbsp;&nbsp;values ('#Name#','#City#','#State#','#ZipCode#')<br>&nbsp;&nbsp;&lt;/cfquery&gt;<br><br>&nbsp;&nbsp;&lt;cfquery name=&quot;EnteredRecord&quot; datasource=&quot;OPE&quot;&gt;<br>&nbsp;&nbsp;SELECT MAX(ID) AS ID<br>&nbsp;&nbsp;FROM dbo.MyTestTable<br>&nbsp;&nbsp;&lt;/cfquery&gt;<br><br>&nbsp;&nbsp;&lt;cfquery name=&quot;EditedInfo&quot; datasource=&quot;ope&quot;&gt;<br>&nbsp;&nbsp;Select * FROM MyTestTable<br>&nbsp;&nbsp;Where ID = #EnteredRecord.ID#<br>&nbsp;&nbsp;&lt;/cfquery&gt; <br>&lt;/cftransaction&gt;<br><br>&lt;html&gt;<br>&lt;head&gt;&lt;title&gt;Information&lt;/title&gt;&lt;/head&gt;<br><br>&lt;body&gt;<br><br>&lt;h2 align=&quot;CENTER&quot;&gt;Review/EditInformation&lt;/h2&gt;<br>&lt;h3&gt;This is what you entered:&lt;/h3&gt;<br><br>&lt;cfoutput query=&quot;EditedInfo&quot;&gt;<br><br>&lt;h3 align=&quot;CENTER&quot; style=&quot;color: Navy;&quot;&gt;Below is a review of the entered data:&lt;/h3&gt;<br><br>&lt;table width=&quot;100%&quot; border=&quot;1&quot; cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; align=&quot;CENTER&quot; valign=&quot;MIDDLE&quot;&gt;<br>&lt;tr&gt;<br>&nbsp;&nbsp;&lt;th&gt;Name&lt;/th&gt;&lt;td&gt;#Name#&lt;/td&gt;<br>&nbsp;&nbsp;&lt;th&gt;City&lt;/th&gt;&lt;td&gt;#City#&lt;/td&gt;<br>&nbsp;&nbsp;&lt;th&gt;ST&lt;/th&gt;&lt;td&gt;#State#&lt;/td&gt;<br>&nbsp;&nbsp;&lt;th&gt;ZipCode&lt;/th&gt;&lt;td&gt;#ZipCode#&lt;/td&gt;<br>&lt;/tr&gt;<br>&lt;/table&gt;<br><br>&lt;h3 style=&quot;font-size: medium; text-align: center; color: Navy;&quot;&gt;THANK YOU - YOUR REQUEST WILL BE PROCESSED!!!&lt;/font&gt;&lt;/h3&gt;<br>&lt;div align=&quot;center&quot;&gt;<br>&lt;a href=TestFormThree.cfm?ID=#ID#&gt;&lt;Font size=-1&gt;[EDIT]&lt;/font&gt;&lt;/a&gt;<br>&lt;/div&gt;<br>&lt;/cfoutput&gt; <br><br>&lt;/form&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br></b></font><br><br>Again, a few stray tags..&nbsp;&nbsp;Also, I put your queries in a CFTRANSACTION so they will all run one after another.&nbsp;&nbsp;If you don't do this, it's possible another process will insert to this table before your select statements...<br></font><font color=#ff33ff><br>FORM THREE<FONT FACE=monospace><b><br>&lt;cfquery name=&quot;MoreEditedInfo&quot; datasource=&quot;ope&quot;&gt;<br>Select * FROM MyTestTable<br>Where ID = #ID# <br>&lt;/cfquery&gt;<br><br>&lt;html&gt;<br>&lt;head&gt;&lt;title&gt; - Edit Information&lt;/title&gt;&lt;/head&gt;<br>&lt;body bgcolor=&quot;#FFFFFF&quot;&gt;<br><br>&lt;h2 align=&quot;CENTER&quot;&gt;Review/Edit&nbsp;&nbsp;Information&lt;/h2&gt;<br>&lt;h3&gt;This is what you entered:&lt;/h3&gt;<br><br>&lt;cfoutput query=&quot;MoreEditedInfo&quot;&gt;<br>&lt;Form Action=&quot;ThisLittleFormWorks.cfm&quot; Method=post&gt; <br>&lt;input type=&quot;hidden&quot; name=&quot;ID&quot; value=&quot;#ID#&quot;&gt;<br>&lt;table width=&quot;100%&quot; border=&quot;1&quot; cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; align=&quot;CENTER&quot; valign=&quot;MIDDLE&quot;&gt;&nbsp;&nbsp;<br>&lt;tr&gt;<br>&nbsp;&nbsp;&lt;th&gt;Name&lt;/th&gt;&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;Name&quot; size=15 value=&quot;#Name#&quot;&gt;&lt;/td&gt;<br>&nbsp;&nbsp;&lt;th&gt;City&lt;/th&gt;&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;City&quot; size=20 value=&quot;#City#&quot;&gt;&lt;/td&gt;<br>&lt;/tr&gt;<br>&lt;tr&gt;<br>&nbsp;&nbsp;&lt;th&gt;State&lt;/th&gt;&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;ST&quot; size=2 value=&quot;#State#&quot;&gt;&lt;/td&gt;<br>&nbsp;&nbsp;&lt;th&gt;Zip Code&lt;/th&gt;&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;ZipCode&quot; size=11 value=&quot;#ZipCode#&quot;&gt;&lt;/td&gt;<br>&lt;/tr&gt;<br>&lt;/table&gt;<br>&lt;p align=&quot;center&quot;&gt; <br>&lt;input type=&quot;submit&quot; value=&quot;Update Record&quot;&gt;<br>&lt;/form&gt;<br>&lt;/cfoutput&gt;<br><br>&lt;/body&gt;<br>&lt;/html&gt;</b></font><br><br>The biggest problem I saw was that your link at the bottom should have been a form submit button.&nbsp;&nbsp;The link won't pass the changes you made to the form....<br></font><font color=#009900><br>LAST FORM<FONT FACE=monospace><b><br>&lt;cfparam name=&quot;Name&quot; default=&quot;&quot;&gt;<br>&lt;cfparam name=&quot;City&quot; default=&quot;&quot;&gt;<br>&lt;cfparam name=&quot;State&quot; default=&quot;&quot;&gt;<br>&lt;cfparam name=&quot;ZipCode&quot; default=&quot;&quot;&gt;<br>&lt;cfquery datasource=&quot;ThisLittleQueryWorked&quot;&gt;<br>UPDATE MyTestTable<br>SET<br>&nbsp;Name='#Name#',<br>&nbsp;City='#City#',<br>&nbsp;State='#State#',<br>&nbsp;ZipCode='#ZipCode#'<br>WHERE ID = #ID#<br>&lt;/cfquery&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>&lt;title&gt;Record Updated&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>&lt;table&gt;<br>&lt;tr&gt;<br>&nbsp;&nbsp;&lt;th&gt;Name&lt;/th&gt;<br>&nbsp;&nbsp;&lt;td&gt;#Name#&lt;/td&gt;<br>&nbsp;&nbsp;&lt;th&gt;City&lt;/th&gt;<br>&nbsp;&nbsp;&lt;td&gt;#City#&lt;/td&gt;<br>&lt;/tr&gt;<br>&lt;tr&gt;<br>&nbsp;&nbsp;&lt;th&gt;ST&lt;/th&gt;<br>&nbsp;&nbsp;&lt;td&gt;#ST#&lt;/td&gt;<br>&nbsp;&nbsp;&lt;th&gt;ZipCode&lt;/th&gt;<br>&nbsp;&nbsp;&lt;td&gt;#ZipCode#&lt;/td&gt;<br>&lt;/tr&gt;<br>&lt;/table&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br></b></font><br>There was no real problems here, except that I took the single quotes off the ID in the update statement.&nbsp;&nbsp;(Single quotes should not be used with numerical values...)<br></font><br>This should work okay, if not let me know and I'll see what I can do...
 
Darkman,<br><br>Many, many, MANY thanks!!!&nbsp;&nbsp;My pages now include an update functionality that works!!!&nbsp;&nbsp;You TOTALLY rule!&nbsp;&nbsp;<br><br>Words REALLY can't express my gratitude; especially after spending many hours working on this, following examples, and not having much success.<br><br>You should write a CF developer's manual!<br><br>
 
In your last page which is doing the updates give the parameters a form. prefix i.e
<cfparam name=&quot;form.name&quot; default=&quot;&quot;>

and when updating use #form.name#

While you can get away without using prefixs such as url. and form. it doen't always work the right way. Its better to be more explicit.
I'm guessing all the fields in the database are just being updated to blank.

I didn't fully read the code so if this is way off the problem sorry.

Also is the id field a number/autonumber. If so don't use single quotes in the where clause.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top