System information
80 Chapter 7: Lesson 4: Building Dynamic Queries
</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>
4.
Save the file.
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:
1.
Click the Components tab.
2.
Click the + button next to cfdocs.getting_started.my_app.components.
3.
Click the + button next to gettrips.
4.
Select query getTripsFromForm() and drag it to the top of the triplisting.cfm file.
5.
Change the value of returnvariable to be the name of the query, TripResult, as follows:
returnvariable="TripResult"
6.
Return to Step 3 in the “To create the Trip Search Results page:” section.
Reviewing the code
The following table describes the code used to build the tripLocation WHERE subclause:
Code Explanation
<cfset WhereClause = " 0=0 ">
The cfset tag initializes the WhereClause variable to
hold the WHERE clause to be constructed. The
initial value is set to
" 0=0 " so that the WHERE
clause has at least one subclause in case the user
enters no search criteria.