MACROMEDIA COLFUSION MX 7-GETTING STARTED BUILDING COLDFUSION MX Getting Started page 124

Building coldfusion mx applications
Table of Contents

Advertisement

Using dynamic SQL to browse the Trips table
The
uniquely identifies a trip in the Trips table. In
tripID
Application Page" on page
parameter of the URL. For example, you would use the following URL to display the detail
information for a trip with the ID of 20:
http://localhost/cfdocs/getting_started/my_app/tripdetail.cfm?ID=20
The main objective of the Navigation Action page (navigationaction.cfm) is to navigate to the
Trip Detail page using a URL that includes the correct
clicked. Because trips are added and later deleted, trips might not be ordered sequentially by ID.
There can be missing IDs where trips were deleted. For example, if the current
the user clicks the Next navigation button, the
be 14.
To retrieve the proper
previous, first, or last) ID is, based on the current
dynamic SQL to build a query to find the appropriate ID to use.
In
"Lesson 4: Building Dynamic Queries" on page
to construct the proper SQL SELECT WHERE clause. In this lesson, you use a similar approach
to build the WHERE clause for navigation. Additionally, you use the proper ORDER BY clause
to select the correct trip row from the trips table.
For example, if the current
statement based on the navigation button that the user clicked:
Navigation button SQL statement to navigate to
First Row
Previous Row
Next Row
Last Row
To properly build the SQL SELECT statement for previous and next row navigation, you must
know the current
Detail page. You can use the form variable
building the proper test in the WHERE clause of the SQL SELECT statement.
124
Chapter 11: Lesson 8: Implementing Browsing and Searching
97, you displayed the Trip Detail page for a trip by passing the ID as a
, you must query the database to find out what the next (or
tripID
equals 6, the following table identifies the proper SQL
tripID
correct trip ID
SELECT tripID FROM trips
ORDER BY tripID
SELECT tripID FROM trips
WHERE tripID < 6
ORDER BY tripID DESC
SELECT tripID FROM trips
WHERE tripID > 6
ORDER BY tripID
SELECT tripID FROM trips
ORDER BY tripID DESC
. This is the reason for using the hidden input tag
tripID
"Lesson 6: Creating a Main
based on the navigation button
tripID
of the next trip might not be 11; it could
tripID
. The navigation action page uses
tripID
71, you used ColdFusion string manipulation
SQL statement description
Returns the list of all
(1,2,3...) order.
Returns the list of all
descending (5,4,3...) order.
Returns the list of all
in ascending (7,8,9...) order.
Returns the list of all
(99,98,97...) order.
in the Navigation Action page for
#Form.RecordID#
is 10 and
tripID
in ascending
tripIDs
less than 6 in
tripIDs
greater than 6
tripIDs
in descending
tripIDs
on the Trip
RecordID

Advertisement

Table of Contents
loading
Need help?

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

This manual is also suitable for:

Colfusion mx 7 - installing and using coldfusion mx

Table of Contents