Programming instructions

iv Contents
Processing form data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26
Form processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26
Commenting your code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28
CHAPTER 3 Database Fundamentals . . . . . . . . . . . . . . . . . . . . . . . 29
Understanding database basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30
What is a relational database? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30
Understanding relational tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31
About SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32
Using SQL to interact with a database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32
Using SQL with ColdFusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
About data sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
Writing SQL and CFML statements to interact with a data source. . . . . . . . . . . . . . . . . .33
CFML tags that interact with a database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
CHAPTER 4 Configuring Your Development Environment. . . . . . 35
Verifying the tutorial file structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36
Configuring database connection and debugging options . . . . . . . . . . . . . . . . . . . . . . . . . .37
Configuring the connection to the sample database file . . . . . . . . . . . . . . . . . . . . . . . . . .37
Enabling debugging options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40
Macromedia development environment tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .43
The Dreamweaver MX environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44
Configuring Dreamweaver MX for ColdFusion development. . . . . . . . . . . . . . . . . . . . . .45
Configuring HomeSite+ for ColdFusion development . . . . . . . . . . . . . . . . . . . . . . . . . . .45
Part II Building a ColdFusion Application . . . . . . . . . . . . . . . . . . . . . 47
LESSON 1 Preparing to Build the Sample Application . . . . . . . . . 49
Application development steps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50
Determining the application functional requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51
Determining the data requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .52
Designing the database for your application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53
Developing the sample application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55
How to proceed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55
LESSON 2 Writing Your First ColdFusion Application . . . . . . . . . 59
Creating your first ColdFusion application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .60
Application development steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .61
Using a web page to list trips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .62
Converting to a dynamic web page. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .62
Using SQL with cfquery to dynamically retrieve information . . . . . . . . . . . . . . . . . . . . . .64
Creating a dynamic web page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .66
Developing a search capability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69
Designing the search criteria page. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69
Building the Search Results page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .73
Completing the Trip Search Results page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .76
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80
In the next lesson . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80