Guest_imported
New member
- Jan 1, 1970
- 0
I have my query display a list of queries. I would like to only allow 4 per page with a next text link for more then 4.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<CFPARAM NAME="getdata.db_listings_pp" VALUE="4">
<!--- The Above Code is needed if you don't have a field in your database named "db_listings_pp" If you have this value in your DB, it will dynamically figure out how to do the "next" and "previous" things. So, if you don't have that field, you must use this CFPARAM --->
<CFQUERY NAME="GetData">
SELECT *
FROM
</CFQUERY>
<cfparam name="nextflag" default="false">
<cfparam name="backflag" default="false">
<cfparam name="startprod" default="1">
<cfset maxrowsnum = #getinfo.db_listings_pp#>
<cfset endprod = #startprod# + (#getinfo.db_listings_pp# - 1)>
<!--- Deciding weather or not the "next" or "previous" page text should appear by flagging it --->
<cfif #getdata.recordcount# gt #endprod#>
<cfset nextflag = "true">
</cfif>
<cfif #startprod# gte (#getinfo.db_listings_pp# + 1)>
<cfset backflag = "true">
</cfif>
<!--- /deciding... --->
<!--- An output of how many records were returned --->
<cfoutput>
<cfif #nextflag# eq "true">
<P CLASS="small">Showing items #startprod# - #endprod#
<cfelseif #nextflag# eq "false" AND #backflag# eq "true">
<P CLASS="small">Showing items #startprod# - #getdata.recordcount#
<cfelse>
<P CLASS="small">Showing all Items
</cfif>
</cfoutput>
<!--- An Output of how many records were returned --->
<!--- /Figuring Out Stuff --->
<!--- Core Output Of Infro From DB --->
<TABLE>
<CFOUTPUT QUERY="GetData" STARTROW="#startprod#" MAXROWS="#maxrowsnum#">
<TR>
<TD bgcolor="#IIf(CurrentRow mod 2 is 1, DE("FFFFFF"), DE("EFEFEF"))#"><P CLASS="small">#data#</TD>
</TR>
</CFOUTPUT>
</TABLE>
<!--- /Core Output ... --->
<!--- Next / Previous links --->
<CFOUTPUT>
<!--- setting starting points for "next" and "previous" pages --->
<cfset fwstartnum = #endprod# + 1>
<cfset bwstartnum = #startprod# - #getinfo.db_listings_pp#>
<!--- /setting --->
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD WIDTH="50%" ALIGN="LEFT"><P CLASS="small">
<cfif #backflag# eq "true">
<A HREF="page.cfm?page=dsp_db_listing&startprod=#bwstartnum#">« Previous Page</A>
</CFIF>
</TD>
<TD WIDTH="50%" ALIGN="RIGHT"><P CLASS="small">
<cfif #nextflag# eq "true">
<A HREF="page.cfm?startprod=#fwstartnum#">Next Page »</A>
</CFIF>
</TD>
</TR>
</TABLE>
</CFOUTPUT>
<!--- /Next / Previous Links--->
<CFPARAM NAME="getdata.db_listings_pp" DEFAULT="4">