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

Chapter 7. Implementing ColdFusion Loops > Looping Over a Set of Query Results

Looping Over a Set of Query Results

Another way to use <cfloop> is to have it perform the loop code once for each record that comes back from a database query. To do so, you need only specify the name of the query variable holding the retrieved data. For example, if ColdFusion has performed the following query

<cfquery datasource="sales" name="qGetCustomerData"> 
SELECT *
FROM Customers
ORDER BY LastName, FirstName
</cfquery>


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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