![MACROMEDIA COLDFUSION 4.5-CFML LANGUAGE Скачать руководство пользователя страница 155](http://html1.mh-extra.com/html/macromedia/coldfusion-4-5-cfml-language/coldfusion-4-5-cfml-language_reference_3287257155.webp)
Chapter 1: ColdFusion Tags
131
<CFSET CountVar=Co 1>
The loop index is <CFOUTPUT>#CountVar#</CFOUTPUT>.<BR>
</CFLOOP>
The result of this loop in a browser would look something like:
The loop index is 1.
The loop index is 2.
The loop index is 3.
The loop index is 4.
The loop index is 5.
Looping over a Query
A loop over a query repeats for every record in the query record set. The CFLOOP
results are just like a
CFOUTPUT
. During each iteration of the loop, the columns of the
current row will be available for output. CFLOOP allows you to loop over tags that can
not be used inside CFOUTPUT.
Syntax
<CFLOOP QUERY="query_name"
STARTROW="row_num"
ENDROW="row_num">
QUERY
Required. Specifies the query that will control the loop.
STARTROW
Optional. Specifies the first row of the query that will be included in the loop.
ENDROW
Optional. Specifies the last row of the query that will be included in the loop.
Example 1
The following example shows a CFLOOP looping over a query that works in the same
way as a CFOUTPUT tag using the QUERY attribute:
<CFQUERY NAME="MessageRecords"
DATASOURCE="cfsnippets">
SELECT * FROM Messages
</CFQUERY>
<CFLOOP QUERY="MessageRecords">
<CFOUTPUT>#Message_ID#</CFOUTPUT><BR>
</CFLOOP>
Example 2
CFLOOP also provides iteration over a recordset with dynamic starting and stopping
points. Thus you can begin at the tenth row in a query and end at the twentieth. This
mechanism provides a simple means to get the next n sets of records from a query.
Содержание COLDFUSION 4.5-CFML LANGUAGE
Страница 1: ...Allaire Corporation CFML Language Reference ColdFusion 4 5...
Страница 207: ...Chapter 1 ColdFusion Tags 183 CFCATCH CFTRY BODY HTML...
Страница 224: ...200 CFMLLanguageReference CFOUTPUT P Text within CFOUTPUT is always shown CFOUTPUT BODY HTML...
Страница 296: ...272 CFMLLanguageReference INPUT TYPE text NAME number2 BR INPUT TYPE submit NAME submit VALUE Add FORM BODY HTML...
Страница 336: ...312 CFMLLanguageReference CFIF BODY HTML...
Страница 404: ...380 CFMLLanguageReference DE It is morning CFOUTPUT P BODY HTML...
Страница 413: ...Chapter 2 ColdFusion Functions 389 Customer BalanceDue BR CFOUTPUT CFIF BODY HTML...
Страница 483: ...Chapter 2 ColdFusion Functions 459 CFOUTPUT CFLOOP BODY HTML...
Страница 557: ...Chapter 2 ColdFusion Functions 533 P CFOUTPUT Value i is employee keysToStruct i CFOUTPUT P CFLOOP CFIF BODY HTML...
Страница 584: ...560 CFMLLanguageReference...
Страница 594: ...570 CFMLLanguageReference...