56
Chapter 4 Retrieving and Formatting Data
<cfif form.lastname is not "">
AND Employee.LastName = ’#Form.LastName#’
</cfif>
</cfquery>
<cfif GetEmployees.recordcount is "0">
No records match your search criteria. <br>
Please go back to the form and try again.
<cfelse>
<h4>Employee Data Based on Criteria from Form</h4>
<table>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Salary</th>
</tr>
<cfoutput query="GetEmployees">
<tr>
<td>#FirstName#</td>
<td>#LastName#</td>
<td>#Salary#</td>
</tr>
</cfoutput>
</cfif>
</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.
Returning results incrementally
You can use the
cfflush
tag to incrementally output long-running requests to the
browser before a ColdFusion page is fully processed. This allows you to give the user
quick feedback when it takes a long time to complete processing a request. For
example, you can use
cfflush
to display the message, “Processing your request --
please wait.” when a request takes time to return. You can also use it to
incrementally display a long list as it gets retrieved.
The first time you use the
cfflush
tag on a page, it sends to the browser all of the
HTML headers and any other available HTML. Subsequent
cfflush
tags on the page
send only the output that ColdFusion generated since the previous flush.
You can specify an
interval
attribute to tell ColdFusion to flush the output each
time that at least the specified number of bytes become available. (The count does
not include HTML headers and any data that is already available when you make this
call.) You can use the
cfflush
tag in a
cfloop
to incrementally flush data as it
becomes available. This format is particularly useful when a query responds slowly
with large amounts of data.
Summary of Contents for COLDFUSION 5-DEVELOPING
Page 1: ...Macromedia Incorporated Developing ColdFusion Applications MacroMedia ColdFusion 5 ...
Page 58: ...38 Chapter 3 Querying a Database ...
Page 134: ...114 Chapter 7 Updating Your Database ...
Page 210: ...190 Chapter 10 Reusing Code ...
Page 232: ...212 Chapter 11 Preventing and Handling Errors ...
Page 238: ...218 Chapter 12 Using the Application Framework ...
Page 262: ...242 Chapter 12 Using the Application Framework ...
Page 278: ...258 Chapter 13 Extending ColdFusion Pages with CFML Scripting ...
Page 320: ...300 Chapter 15 Indexing and Searching Data ...
Page 336: ...316 Chapter 16 Sending and Receiving E mail ...
Page 374: ...354 Chapter 18 Interacting with Remote Servers ...