</td>
</tr>
<cfoutput query="TripResult">
<tr>
<td>#tripName#
</td>
<td>#tripLocation#
</td>
<td>#departureDate#
</td>
<td>#returnDate#
</td>
<td>#price#
</td>
</tr>
</cfoutput>
</table>
</body>
</html>
Save the file.
4.
Let Dreamweaver do it
As you have in previous exercises, you can let Dreamweaver generate the code to invoke the
method.
To invoke the method using Dreamweaver:
Click the Components tab.
1.
Click the + button next to cfdocs.getting_started.my_app.components.
2.
Click the + button next to gettrips.
3.
Select query getTripsFromForm() and drag it to the top of the triplisting.cfm file.
4.
Change the value of
5.
returnvariable="TripResult"
Return to Step 3 in the
6.
Reviewing the code
The following table describes the code used to build the tripLocation WHERE subclause:
Code
<cfset WhereClause = " 0=0 ">
80
Chapter 7: Lesson 4: Building Dynamic Queries
to be the name of the query, TripResult, as follows:
returnvariable
"To create the Trip Search Results page:"
Explanation
The
tag initializes the
cfset
hold the WHERE clause to be constructed. The
initial value is set to
" 0=0 "
clause has at least one subclause in case the user
enters no search criteria.
section.
variable to
WhereClause
so that the WHERE
Need help?
Do you have a question about the COLFUSION MX 7-GETTING STARTED BUILDING COLDFUSION MX and is the answer not in the manual?
Questions and answers