Chapter 4: Retrieving and Formatting the Data You Want
<BODY>
<CFQUERY NAME="GetEmployees" DATASOURCE="CompanyInfo">
SELECT
WHERE Departments.Department_ID = Employees.Department_ID
</CFQUERY>
<H4>Employee Data Based on Criteia from Form</H4>
4
<CFIF GetEmployees.RecordCount IS "0">
4
No records match your search criteria. <br>
4
Please go back to the form and try again.
4
<CFELSE>
<TABLE>
<TR>
</TR>
<CFOUTPUT QUERY="GetEmployees">
<TR>
</TR>
</CFOUTPUT>
</TABLE>
</BODY>
</HTML>
3.
Save the file.
4.
Return to the form, enter search criteria and submit the form.
5.
If no records match the criteria you specified, the message displays.
Departments.Department.Name,
Employees.FirstName,
Employees.LastName,
Employees.StartDate,
Employees.Salary
FROM Departments, Employees
<CFIF Form.Department_Name IS NOT "">
AND Departments.Department_Name = 'Form.Department_Name'
<TH>First Name</TH>
<TH>Last Name</TH>
<TH>Salary</TH>
<TD>#FirstName#</TD>
<TD>#LastName#</TD>
<TD>#Salary#</TD>
43