Code Review - MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual

Developing web applications with coldfusion
Table of Contents

Advertisement

Chapter 4: Retrieving and Formatting the Data You Want
<CFIF Form.LastName IS NOT "">
AND Employees.LastName = 'Form.LastName'
</CFIF>
</CFQUERY>

Code Review

Code
SELECT
Departments.Department.Name,
Employees.FirstName,
Employees.LastName,
Employees.StartDate,
Employees.Salary
FROM Departments, Employees
WHERE 1=1
<CFIF Form.LastName IS NOT "">
AND Employees.LastName = 'Form.LastName'
</CFIF>
To build a flexible search interface:
1.
Return to
2.
Modify the page so that it appears as follows:
<HTML>
<HEAD>
<TITLE>Retrieving Employee Data Based on Criteria from Form</TITLE>
</HEAD>
<BODY>
<CFQUERY NAME="GetEmployees" DATASOURCE="CompanyInfo">
4
SELECT
4
Employees.FirstName,
4
Employees.LastName,
4
Employees.StartDate,
4
Employees.Salary
4
FROM Departments, Employees
4
WHERE Departments.Department_ID = Employees.Department_ID
4
<CFIF Form.Department_Name IS NOT "">
4
AND Departments.Department_Name = 'Form.Department_Name'
4
</CFQUERY>
<H4>Employee Data Based on Criteia from Form</H4>
<TABLE>
<TR>
<TH>Salary</TH>
in Studio.
actionpage.cfm
Departments.Department.Name,
<TH>First Name</TH>
<TH>Last Name</TH>
Description
Retrieve the fields listed from the Departments
and Employees tables, joining the tables based
on the Department_ID field in each table.
But if the user specified a last name in the form,
only retrieve the records where the last name is
the same as the one the user entered in the
form.
41

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?

This manual is also suitable for:

Coldfusion 4.5

Table of Contents