Returning Query Results To The User - MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual

Developing web applications with coldfusion
Table of Contents

Advertisement

42
</TR>
<CFOUTPUT QUERY="GetEmployees">
<TR>
<TD>#FirstName#</TD>
<TD>#LastName#</TD>
<TD>#Salary#</TD>
</TR>
</CFOUTPUT>
</TABLE>
</BODY>
</HTML>
3.
Save the file.
4.
Test the search interface in your browser.
The returned records will not be displayed because you have not entered that code
yet, however, you will see the number of records returned if you have debugging
enabled.

Returning Query Results to the User

When you build search interfaces, keep in mind that there won't always be a record
returned. If there is at least one record returned from a query, you will usually format
that data using an HTML table. But to make sure that a search has retrieved records,
you will need to test if any records have been returned using the recordcount variable
in a conditional logic expression in order to display search results appropriately to
users.
For example, to inform the user that no records were found if the number of records
returned for the GetEmployees query is 0, insert the following code before displaying
the data:
<CFIF GetEmployees.RecordCount IS "0">
<CFELSE>
Prefix RecordCount with the queryname.
Add a true procedure that displays a message to the user.
Add a not true procedure after the CFELSE tag to format the returned data
using an HTML table.
To return search results to users:
1.
Return to
2.
Add the code indicated.
<HTML>
<HEAD>
<TITLE>Retrieving Employee Data Based on Criteia from Form</TITLE>
</HEAD>
No records match your search criteria. <BR>
in Studio.
actionpage.cfm
Developing Web Applications with ColdFusion

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?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion 4.5

Table of Contents