Paul or whoever can answer me, having a hard time understanding some of
this logic. The next botton and previous buttons do not work, and seem to
be switched. Any ideas what I am doing wrong ? Here is the code, thanks.
<!--- Initialize Constants --->
<CFSET MaxClasses = 5>
<CFPARAM name="start" DEFAULT="1">
<cfquery name="manf" datasource="houseboat">
SELECT id, state, statename, company
FROM HBMF
Order by state
</CFQUERY>
<cfquery name="getmanf" datasource="houseboat">
SELECT id, state, statename, company
FROM HBMF
Order by company
</CFQUERY>
</head>
<!--- Create List of IDs --->
<cfset IDlist = ValueList(manf.ID)>
<cfset ListLength = ListLen(IDlist)>
<!--- Create List of Query IDs --->
<cfset QueryList = "">
<cfset I = 0>
<cfloop query="manf">
<cfset I=manf.state>
<cfset QueryList = ListAppend(QueryList,I)>
</cfloop>
<!--- Create Empty List --->
<cfset start_list = "">
<!--- Create List of Start Row Numbers in Query using ListFind --->
<cfloop index="jndex" list="#IDlist#">
<cfset Getmanf = jndex>
<cfset start_list=ListAppend(start_list,ListFind(QueryList,Getmanf))>
</cfloop>
<body>
<CFOUTPUT query="manf" GROUP="statename" startrow="#start#"
maxrows="#MaxClasses#">
<B><font size=+1 color="##6600CC"> #statename#</font></B><Br>
<UL>
<CFOUTPUT><a href="manufacturers3.cfm?id=#id#">
<LI><B>#company#</B></A>
</CFOUTPUT>
</UL>
</CFOUTPUT>
<!--- What are the previous and next row to start --->
<CFSET start_position = ListFind("#start_list#","#start#")>
<cfset prev_start_position = start_position - MaxClasses>
<cfif prev_start_position GT 0>
<cfset PrevStart = ListGetAt("#start_list#",#prev_start_position#)>
<cfelse>
<cfset PrevStart = 0>
</cfif>
<cfset next_start_position = start_position + MaxClasses>
<cfif next_start_position LTE ListLength>
<cfset NextStart = ListGetAt("#start_list#",#next_start_position#)>
<cfelse>
<cfset NextStart = GetNews.RecordCount>
</cfif>
<!--- Previous Button Code --->
<center>
<CFIF PrevStart GTE 1>
<CFOUTPUT>
<FORM ACTION="manufacturers.cfm" method="post">
<INPUT type="hidden" NAME="START" VALUE="#PrevStart#">
<INPUT type="submit" value="Next #MaxClasses#">
</FORM>
</CFOUTPUT>
</center>
</CFIF>
<!--- Next Button Code --->
<td colspan="2"><center>
<CFIF NextStart LT GetNEWS.RecordCount>
<CFOUTPUT>
<FORM ACTION="index.cfm" method="post">
<INPUT type="hidden" NAME="START" VALUE="#NextStart#">
<INPUT type="submit" value="Previous #MaxClasses#">
</FORM>
</cfoutput>
</center>
</cfif>
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.