• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 4. Interacting with Databases: R... > Performing User-Driven Queries

Performing User-Driven Queries

All the SELECT queries you have seen so far are static queries; that is, you're issuing the same SQL statement time after time. Static SELECT queries have their place, but it can be more interesting to create SELECT queries in which some part of the query is determined by the user by means of HTML form submission. The examples in this section show you how to build interfaces that enable users to query your database tables and see the records that are returned by those queries.

Example: Picking from Existing Records

One way to let users search your database is to present them with a listing that summarizes the records you have and to allow them to choose a record to review in more detail. Listing 4.4 showed how to generate a drop-down list of customer names. When you pick a customer from this list and click the submit button, the processing script called showcustomerdetail.cfm retrieves the chosen customer's record and shows you the contents. Listing 4.5 illustrates how to display the customer's detail record, and Figure 4.5 shows the resulting detail page.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint