Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ouput certain rows of query

Status
Not open for further replies.

ecintern

Programmer
Feb 23, 2001
7
CA
I am running a query that may have up to 300 hits. I only want to return 25 of them at a time, giving the user the option of viewing the next 25 or the previous 25. Is there a way to do this is coldfusion

Thanks
 
Try inserting the MAXROWS and STARTROW attributes onto your CFQUERY and set up your Prev & Next hyperlink with the start row values.

---------------

<CFOUTPUT QUERY=&quot;MyQuery&quot; MAXROWS=&quot;25&quot; STARTROW=&quot;#URL.CurStartRow#&quot;>

#MyQueryVar1#, #MyQueryVar2#

</CFOUTPUT>

<!--- If user just entered this page, we assumed no CurStartRow is passed. Hard code next start row --->
<CFIF NOT IsDefined(&quot;CurStartRow&quot;)>
<CFSET NextStartRow = 26>
<CFELSE>
<!--- If --->
<CFIF CurStartRow GTE 25>
<CFSET StartRow = CurStartRow - 25>
<CFELSE>
<CFSET StartRow = 1>
</CFIF>
<CFSET NextStartRow = CurStartRow + 1>
</CFIF>

<CFIF IsDefined(&quot;CurStartRow&quot;)>
<A HREF=&quot;mytemplate.cfm?CurStartRow=#PrevStartRow#&quot;>Prev</A>
<CFIF>
<A HREF=&quot;mytemplate.cfm?CurStartRow=#NextStartRow#&quot;>Next</A>


HTH.

Klotzki
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top