This is the code I have to navigate through the database by
previous and next links, the issue I'm having is for the previous
when i click on the previous link, it stays on the same page and
the issue i have with the next link is, it works fine up until
there is no more information from the database to be displayed and
if at that point i click on the next link the page gives an error.
not sure how to fix this, can anyone help?
<CFPARAM NAME="start" DEFAULT="1">
<CFIF start + 2 GT displayinfo.RecordCount>
<CFSET maxRows = displayinfo.RecordCount - start>
<CFELSE>
<CFSET maxRows = 2>
</CFIF>
<CFOUTPUT QUERY="displayinfo" STARTROW=#start#
MAXROWS=#maxRows#>
#name# <br> #address# <br><br>
</CFOUTPUT>
<cfif displayinfo.recordcount gt 2>
<CFOUTPUT>
<!--- next --->
<CFSET start = start + 2>
<CFIF start GT displayinfo.RecordCount>
<CFSET start = 1>
</CFIF>
<A HREF="/test.cfm?n=#url.n#&start=#start#"><img
src="/images/next-text-arrow.gif" border="0"></A>
<!--- previous --->
<CFSET start = start - 10>
<CFIF start LE 0>
<CFSET start = (displayinfo.RecordCount \ 10) & 1>
</CFIF>
<A HREF="/test.cfm?n=#url.n#&start=#start#"><img
src="/images/prev-text-arrow.gif" border="0"></A>
</CFOUTPUT>
</cfif>