• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Outputting Query Results

A <cfquery> tag can retrieve data from the database for you, but to get that data out of ColdFusion's memory and onto a Web page, you have to use the <cfoutput> tag you learned about in Chapter 2, “Variables and Variable Scope.” In this case, however, you can add a query attribute to the <cfoutput> instruction to tell it to use data from your query to create the output.

When you give <cfoutput> a set of query results to work with, it will generate one piece of output for each record that was retrieved by the query. This means you can generate a lot of HTML output with a very small amount of CFML code. To illustrate the point, consider the following short example:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint