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!

previous next functionality 1

Status
Not open for further replies.

fusionaire

Programmer
May 20, 2000
67
US
Does anyone know how to make "previous" and "next" links that are from a db query without having to use custom tags?
 
yup.
just create a variable for your starting row:
<CFPARAM NAME=&quot;StartRow&quot; DEFAULT=&quot;1&quot;>

then, you can either ask the user for maxrows, or declare your own, then output your query:
<cfoutput QUERY=&quot;queryName&quot; STARTROW=&quot;#StartRow#&quot; MAXROWS=&quot;30&quot;>

at the end, you'll want to do your calculations and link to the same page incrementing your startrow. This is what i did incrementing 30:
<cfoutput>
<cfif StartRow IS 1>First 30
<cfelse>
<a href=&quot;thispage.cfm&quot;>First 30</a>
</cfif>
<cfif (StartRow - 30) GT 0>
<-- <a href=&quot;thispage.cfm?startrow=#evaluate(StartRow-30)#&quot;>Previous 30</a>
<cfelse>
<-- Previous 30
</cfif>
<CFIF (StartRow + 30) LTE GetContacts.RecordCount><a href=&quot;thispage.cfm?startrow=#evaluate(StartRow+30)#&quot;>Next 30</a> -->
<cfelse>Next 30 -->
</cfif>
</cfoutput>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top