
58
Chapter 4 Retrieving and Formatting Data
Reviewing the code
The following table describes the code and its function:
Code
Description
<H2>We are sure you will agree it was
worth the short wait!</H2>
<cfflush>
Send the HTML header and all HTML
output to the
cfflush
tag to the user.
This displays the explanatory paragraph
and H2 tag contents.
<cfflush interval=10>
Flush additional data to the user every
time at least ten bytes are available.
<cfloop index="randomindex" from="1"
to="200000" step="1">
<cfset random=Rand()>
</cfloop
>
Insert an artificial delay by using the
Rand
function to calculate many random
numbers.
<cfloop index="Myindex" from="1"
to="10" step="1">
<cfloop index="randomindex"
from="1" to="100000" step="1">
<cfset random=rand()>
</cfloop>
<cfoutput>
Magic number number #Myindex#
is: #RandRange
(100000,999999)#<br><br>
</cfoutput>
</cfloop>
Generate and display ten random
numbers. This code uses two loops. The
outer loop is repeated ten times, once for
each number to display. The inner loop
uses the
rand
function to create another
delay by generating more (unused)
random numbers. It then calls the
RandRange
function to generate a
six-digit random number for display.
Содержание COLDFUSION 5-DEVELOPING
Страница 1: ...Macromedia Incorporated Developing ColdFusion Applications MacroMedia ColdFusion 5 ...
Страница 58: ...38 Chapter 3 Querying a Database ...
Страница 134: ...114 Chapter 7 Updating Your Database ...
Страница 210: ...190 Chapter 10 Reusing Code ...
Страница 232: ...212 Chapter 11 Preventing and Handling Errors ...
Страница 238: ...218 Chapter 12 Using the Application Framework ...
Страница 262: ...242 Chapter 12 Using the Application Framework ...
Страница 278: ...258 Chapter 13 Extending ColdFusion Pages with CFML Scripting ...
Страница 320: ...300 Chapter 15 Indexing and Searching Data ...
Страница 336: ...316 Chapter 16 Sending and Receiving E mail ...
Страница 374: ...354 Chapter 18 Interacting with Remote Servers ...