cfupdate
443
Example
<!--- This example allows you to update a person's telephone number in the
employee table. --->
<cfif isDefined("form.phone")>
<cfupdate datasource="cfdocexamples" tablename="Employees">
</cfif>
<cfquery name="empTable" datasource="cfdocexamples">
select * from employees
</cfquery>
<!--- This code shows the contents of the employee table and allows you to
choose a row for updating. --->
<table border="1">
<cfoutput query="empTable">
<tr>
<td>#firstName#</td>
<td>#lastName#</td>
<td>#phone#</td>
<td><a href="cfupdate.cfm?id=#emp_id#">Edit</a></td>
</tr>
</cfoutput>
</table>
<cfif isDefined("url.id")>
<cfquery name="phoneQuery" datasource="cfdocexamples">
select * from employees where emp_id=#url.id#
</cfquery>
<!--- This code displays the row to edit for update. --->
<cfoutput query="phoneQuery">
<form action="cfupdate.cfm" method="post">
#phoneQuery.firstName# #phoneQuery.lastName#
<input name="phone" type="text" value="#phone#" size="12">
<input type="submit" value="Update">
<input name="emp_id" type="hidden" value="#emp_id#">
<!--- The emp_id is passed as a hidden field to be used as a primary key in
the CFUPDATE. --->
</form>
</cfoutput>
</cfif>
password
Optional
Overrides
the
password
value specified in ODBC setup.
formFields
Optional
(all on
form,
except
keys)
Comma-delimited list of form fields to update.
If a form field is not matched by a column name in the
database, ColdFusion throws an error.
The formFields lies must include the database table
primary key field, which must be present in the form. It can
be hidden.
Attribute
Req/Opt
Default
Description
Summary of Contents for COLFUSION MX 7 - INSTALLING AND USING COLDFUSION MX
Page 1: ...COLDFUSION MX7 CFML Reference...
Page 20: ...20 Chapter 1 Reserved Words and Variables...
Page 50: ...50 Chapter 2 ColdFusion Tags cfelse br Searching cfif cfloop cfif...
Page 101: ...cfdefaultcase 101 cfdefaultcase cfswitch cfoutput Your grade is grade cfoutput...
Page 115: ...cfdocumentsection 115 cfdocumentsection cfoutput cfdocument...
Page 411: ...cftable 411 cftable body html...
Page 515: ...Chr 515 maxlength 5 p input type Submit name input type RESET cfform...
Page 605: ...GetEncoding 605 WriteOutput The encoding is theEncoding cfscript cfif...
Page 629: ...GetProfileString 629 tr td input type Submit name Submit value Submit td td td tr table form...
Page 655: ...IIf 655 cfoutput IIf Hour Now GTE 12 DE It is afternoon or evening DE It is morning cfoutput b...
Page 664: ...664 Chapter 3 ColdFusion Functions cfelse h3 Conversion error h3 cfif...
Page 687: ...IsStruct 687 cfoutput cfquery cfif cfoutput hr Employee Add Complete cfoutput cfcase cfswitch...
Page 751: ...LSDateFormat 751 hr noshade cfoutput cfloop...
Page 861: ...StructFind 861 cfquery cfif cfoutput hr Employee Add Complete cfoutput cfcase cfswitch...
Page 903: ...Val 903 value Is the beginning numeric name form...
Page 932: ...932 Chapter 3 ColdFusion Functions...
Page 944: ...944 Chapter 4 ColdFusion MX Flash Form Style Reference...
Page 962: ...962 Chapter 5 Application CFC Reference...
Page 1054: ...1054 Chapter 6 ColdFusion MX Event Gateway Reference...