User Guide

Using a web page to list trips 65
To enhance the query results:
1 To sort the trip names in alphabetical order in the triplisting.cfm page, modify the SQL
SELECT statement within the
cfquery tags as follows:
SELECT tripName FROM trips ORDER BY tripName
2 To display the departure, return date, and price for each trip, modify the same SQL statement.
a Modify the SQL SELECT statement, as follows:
SELECT tripName, departureDate, returnDate, price
FROM trips
ORDER BY tripName
b Change the output block (the code immediately preceding the </cfoutput> tag) from just
#tripName# to include all three selected fields, as follows:
#tripName# departs: #departureDate# returns: #returnDate# price:
#price#<BR>
3 Create the Budget Trip List report by doing the following:
a Modify the SQL SELECT statement, as follows:
SELECT tripName, departureDate, returnDate, price
FROM trips
WHERE price <= 1500
ORDER BY tripName
b Change the heading tag from <h1>Trip List</h1> to <h1>Budget Trip List</h1>.
4 View the triplisting.cfm in a browser and verify that all the new requirements were met. The
revised TripListing.cfm page looks like this:
Note that the dates and prices in the preceding listing are not formatted. In Lesson 3: Creating
a Main Application Page, you will enhance the look of this page.