here's the code I use on my guestbook.  as you can see, you need to
set vars for the next, back, etc values.  This is what dreamweaver mx
kicks out, btw, but it's not too hard to reverse engineer.

<cfquery datasource="mydb" name="guestview">
SELECT *
FROM GUEST
ORDER BY AddressesID DESC
</cfquery>
<cfset views=#guestview.recordcount#>

<cfset MaxRows_guestview=10>  <!--- set value for max # of items to be
displayed per page --->
<cfset 
StartRow_guestview=Min((PageNum_guestview-1)*MaxRows_guestview+1,Max(guestview.RecordCount,1))>
<!--- set value for first item to be displayed --->
<cfset 
EndRow_guestview=Min(StartRow_guestview+MaxRows_guestview-1,guestview.RecordCount)>
<!--- set value for last item to be displayed --->
<cfset TotalPages_guestview=Ceiling(guestview.RecordCount/MaxRows_guestview)>
 <!--- calculates how many pages, based on # of guestbook record count
--->
<cfset QueryString_guestview=Iif(CGI.QUERY_STRING NEQ
"",DE("&"&CGI.QUERY_STRING),DE(""))>  <!--- checks to see if there are
any results in quest book --->
<cfset 
tempPos=ListContainsNoCase(QueryString_guestview,"PageNum_guestview=","&")>
 <!--- sets current position --->
<cfif tempPos NEQ 0>
  <cfset QueryString_guestview=ListDeleteAt(QueryString_guestview,tempPos,"&")>
</cfif>


<p>
<cfoutput query="guestview" startRow="#StartRow_guestview#" maxRows="1">
<a 
href="#CurrentPage#?PageNum_guestview=1#QueryString_guestview#">First</a>&nbsp;&nbsp;<a
href="#CurrentPage#?PageNum_guestview=#Max(DecrementValue(PageNum_guestview),1)##QueryString_guestview#">Previous</a>&nbsp;&nbsp;<a
href="#CurrentPage#?PageNum_guestview=#Min(IncrementValue(PageNum_guestview),TotalPages_guestview)##QueryString_guestview#">Next</a>&nbsp;&nbsp;<a
href="#CurrentPage#?PageNum_guestview=#TotalPages_guestview##QueryString_guestview#">Last</a>
</cfoutput></p>
        <p><cfoutput>Records #StartRow_guestview# to #EndRow_guestview# of
#guestview.recordcount#</cfoutput></p>

On Fri, 17 Dec 2004 09:39:18 -0600, Jake <[EMAIL PROTECTED]> wrote:
> Yeah, the basic next/previous stuff I've got working fine. The part I'm
> having trouble with is when I apply the next/previous a grouped query.
> So rather than getting something like this:
> 
> Group 1
> - Item 1a
> - Item 2a
> - Item 3a
> Group 2
> - Item 1b
> === next page ===
> Group 3
> - Item 1c
> - Item 2c
> Group 4
> - Item 1d
> - Item 2d
> 
> I end up getting weird things like:
> 
> Group 1
> - Item 1a
> - Item 2a
> Group 4
> - Item 1d
> - Item 2d
> Group 2
> - Item 1b
> === next page ===
> Group 3
> - Item 3a
> - Item 1c
> - Item 2c
> 
> And as mentioned, this is using the grouped query approach:
> 
> <CFOUTPUT query="myQueryName" group="mygroupfield">
> 
>        #Title#
> 
>        <CFOUTPUT group="someotherfield">
> 
>                #Entry#
> 
>        </CFOUTPUT>
> 
> </CFOUTPUT>
> 
> 
> Chris Gomez wrote:
> 
> >here's a good tutorial: http://tutorial290.easycfm.com/. Also,
> >Dreamweaver has that functionality built-in in the Server Behaviors.
> >
> >hope this helps,
> >
> >Chris
> >
> >
> >On Fri, 17 Dec 2004 08:21:13 -0600, Jake <[EMAIL PROTECTED]> wrote:
> >
> >
> >>Re-asking this question, in case it got missed.
> >>
> >>Thanks!
> >>Jake
> >>
> >>-------- Original Message --------
> >>Subject:        Suggestions for grouped query and next/previous paging
> >>Date:   Fri, 10 Dec 2004 22:55:14 -0600
> >>From:   Jake <[EMAIL PROTECTED]>
> >>To:     [EMAIL PROTECTED]
> >>
> >>All,
> >>
> >>I'm outputting a grouped query:
> >>
> >>Group 1
> >>- Item 1a
> >>- Item 2a
> >>- Item 3a
> >>Group 2
> >>- Item 1b
> >>Group 3
> >>- Item 1c
> >>- Item 2c
> >>
> >>and so on...
> >>
> >>but the query results in a large number of records, so I want to add paging.
> >>
> >>The grouping I have no trouble setting up, but how to I break the
> >>results up?
> >>
> >>Thanks!
> >>Jake
> >>
> >>----------------------------------------------------------
> >>To post, send email to [EMAIL PROTECTED]
> >>To unsubscribe:
> >>  http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
> >>To subscribe:
> >>  http://www.dfwcfug.org/form_MemberRegistration.cfm
> >>
> >>
> >>
> >>
> >----------------------------------------------------------
> >To post, send email to [EMAIL PROTECTED]
> >To unsubscribe:
> >   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
> >To subscribe:
> >   http://www.dfwcfug.org/form_MemberRegistration.cfm
> >
> >
> >
> >
> >
> >
> 
> ----------------------------------------------------------
> To post, send email to [EMAIL PROTECTED]
> To unsubscribe:
>   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
> To subscribe:
>   http://www.dfwcfug.org/form_MemberRegistration.cfm
> 
>
----------------------------------------------------------
To post, send email to [EMAIL PROTECTED]
To unsubscribe: 
   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe: 
   http://www.dfwcfug.org/form_MemberRegistration.cfm


Reply via email to