Query Output Notes And Considerations - MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual

Developing web applications with coldfusion
Table of Contents

Advertisement

26
4
#FirstName#, #LastName#, #Salary#, #Contract#<BR>
4
</CFOUTPUT>
</BODY>
</HTML>
3.
Save the file as
4.
View the page in a browser.
A list of employees appears in the browser, with each line displaying one row of
data.
You have created a ColdFusion application page that retrieves and displays data from a
database. At present, the output is raw. You will learn how to format the data in the
next chapter.
Code Review
You now display the results of the query on the page.
Code
<CFOUTPUT QUERY="EmpList">
#FirstName#, #LastName#,
#Salary#, #Contract#
<BR>
</CFOUTPUT>

Query Output Notes and Considerations

When outputting query results, keep these guidelines in mind:
Run a CFQUERY before referencing its results using a CFOUTPUT with a
QUERY attribute.
It's a good idea to run all queries before all output blocks.
A query name must exist on the page in order to successfully output its data.
Surround variable references with pound signs to output their current values to
a page.
Prefix variables with their variable type — in the case of a query variable, it's the
name of the query.
.
emplist.cfm
Description
Display information retrieved in the
EmpList query
Display the value of the
LastName, Salary, Contract
fields of the first record
Insert a line break (go to the next line
Then, keep displaying the fields
you've specified for each record,
followed by a line break, until you run
out of records.
End the CFOUTPUT block
Developing Web Applications with ColdFusion
FirstName,

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