168
Example
<!--- This example shows the use of CFQUERY --->
<HTML>
<HEAD>
<TITLE>CFQUERY Example</TITLE>
</HEAD>
<BODY>
<H3>CFQUERY Example</H3>
<!--- define startrow and maxrows to facilitate
'next N' style browsing --->
<CFPARAM NAME="MaxRows" DEFAULT="10">
<CFPARAM NAME="StartRow" DEFAULT="1">
<!--- query database for information --->
<CFQUERY NAME="GetParks" DATASOURCE="cfsnippets">
SELECT
FROM
ORDER by ParkName, State
</CFQUERY>
<!--- build HTML table to display query --->
<TABLE cellpadding=1 cellspacing=1>
<TR>
<TD colspan=2 bgcolor=f0f0f0>
<B><I>Park Name</I></B>
</TD>
<TD bgcolor=f0f0f0>
<B><I>Region</I></B>
</TD>
<TD bgcolor=f0f0f0>
<B><I>State</I></B>
</TD>
</TR>
<!--- Output the query and define the startrow and maxrows
parameters. Use the query variable CurrentCount to
keep track of the row you are displaying. --->
<CFOUTPUT QUERY="GetParks" StartRow="#StartRow#" MAXROWS="#MaxRows#">
<TR>
<TD valign=top bgcolor=ffffed>
<B>#GetParks.CurrentRow#</B>
</TD>
<TD valign=top>
<FONT SIZE="-1">#ParkName#</FONT>
</TD>
<TD valign=top>
<FONT SIZE="-1">#Region#</FONT>
</TD>
<TD valign=top>
<FONT SIZE="-1">#State#</FONT>
</TD>
PARKNAME, REGION, STATE
Parks
CFML Language Reference
Need help?
Do you have a question about the COLDFUSION 4.5-CFML LANGUAGE and is the answer not in the manual?
Questions and answers