Exercise: update trip data using cfupdate
In this exercise, you will add the code to update the trip data into the database. You will add the
tag to the tripeditaction.cfm page.
cfupdate
To update the database using cfupdate:
In an editor, open tripeditaction3.cfm from the solutions directory.
1
Review the code to update the database (the last 12 lines of code).
2
Verify that the correct photolocation path is specified. This path is specified in the
3
PhotoLocation = "C:...">
For example, depending on your web server configuration, the photolocation path might be:
For MS Windows systems:
<cfset PhotoLocation
"C:\cfusionmx\wwwroot\CFDOCS\getting_started\Photos\">
or
<cfset PhotoLocation =
"C:\Inetpub\wwwroot\CFDOCS\getting_started\Photos\">
For Linux or Solaris systems:
<cfset PhotoLocation = "/opt/cfusionmx/wwwroot/cfdocs/
getting_started/photos/">
or
<cfset PhotoLocation = "/<webserverdocroot>/cfdocs/
getting_started/photos/">
Save the file as tripeditaction.cfm in the my_app directory.
4
For more information about adding data to a database using the
ColdFusion MX Applications.
Now that you have built the data entry form adding new and updating existing trips, you will add
the logic to link it to the main trip page to test the update logic.
Linking the Trip Edit page to the main page
As discussed in
Lesson 4: Validating Data to Enforce Business
maintenance buttons on the main page is maintenanceaction.cfm
the Search and Delete buttons. In the next exercise you will insert the code to call tripedit.cfm
from maintenance.cfm as follows:
<!---
EDIT BUTTON --->
<cfelseif IsDefined("Form.btnEdit")>
<cflocation url="tripedit.cfm?ID=#Form.RecordID#">
<!---
ADD BUTTON --->
<cfelseif IsDefined("Form.btnAdd")>
<cflocation url="tripedit.cfm">
</cfif>
tag.
Completing the Trip Maintenance application
tag, see Developing
cfupdate
Rules, the action page for the
You previously added code for
.
<cfset
125
Need help?
Do you have a question about the COLDFUSION MX 61-GETTING STARTED BUILDING COLDFUSION MX and is the answer not in the manual?