I am using the following script to display next/previous records script based on 
Selene's at Webtricks script shown at the link below.
http://www.webtricks.com/sourcecode/code.cfm?CodeID=7

However in my code below I am stating that there should be only 2 results shown on 
each page, however all results are being returned?/

Any ideas on why this is occuring from the script below???


-----------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<CFQUERY name="list" datasource="intranetv8">
SELECT *
FROM itlinks
WHERE linkarea='#URL.area#'
</CFQUERY>
<!--- Set the number of records to display on each page. --->
<cfset OnEachPage=2>

<!--- Set the default startrow to 1 if a value was not passed. --->
<!--- Determine whether or not to show the previous or next links. --->
<cfparam name="StartRow" default="1">
<!--- Set the value of endrow to the maxrows + startrow - 1 --->
<cfset EndRow=StartRow + OnEachPage - 1>
<!--- If the end row is greater than the recordcount, determine how many records are 
left. --->
<cfif EndRow GTE list.RecordCount>
  <cfset EndRow=list.RecordCount>
  <cfset Next=false>
<!--- Othereise, set Next to true and determine the next set of records. --->
<cfelse>
  <cfset Next=true>
  <cfif EndRow + OnEachPage GT list.RecordCount>
    <cfset NextNum=list.RecordCount - EndRow>
  <cfelse>
    <cfset NextNum= OnEachPage>
  </cfif>
  <cfset NextStart=EndRow + 1>
</cfif>
<!--- If StartRow is 1, set Previous to false. --->
<cfif StartRow IS 1>
  <cfset Previous=false>
  <!--- Othewise, determine the previous set of records. --->
<cfelse>
  <cfset Previous=true>
  <cfset PreviousStart=StartRow - OnEachPage>
</cfif>

<!--- Determine how many pages will be displayed. --->
<cfset NumPages=Ceiling(list.RecordCount / OnEachPage)>
<cfparam name="PageNum" default="1">

<cfif list.recordcount neq 0> 
<TITLE>Links -</TITLE>
</head>

<body>

<cfoutput>
  <span class="bodytext">There are currently #list.RecordCount#  links available to 
you.
  <br>
  Displaying links #StartRow# to #EndRow# </span><p>
</cfoutput>



<cfoutput query="list">
<table border="0" style="border-collapse: collapse" bordercolor="##111111" 
width="100%" id="AutoNumber3" cellspacing="0" cellpadding="0">
  <tr>
    <td width="6%">
    <p align="center">
    <img border="0" 
src="http://intranet.neath-porttalbot.gov.uk/testpages/itnet/images/linkicon.gif"; 
width="15" height="17"></td>
    <td width="94%" colspan="2"><B><a class="homeaa" 
href="#linkurl#">#linktitle#</a></B></td>
  </tr>
  <tr>
    <td width="6%">&nbsp;</td>
    <td width="100%">
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: 
collapse" bordercolor="##111111" width="100%" id="AutoNumber4">
      <tr>
        <td width="100%">


        <p><span class="bodytext">#linkdesc#<br>
        </span>







    <img border="0" 
src="http://intranet.neath-porttalbot.gov.uk/testpages/itnet/images/bluesq.gif"; 
align="absmiddle" width="3" height="3">


    <span class="item1">Added by :</span><span 
class="item2">&nbsp;#linkauthor#</span></p>


        </td>
      </tr>

    </table>
    </td>

  </tr>

  <tr>
    <td width="100%" colspan="3">
    <p align="center">
    <img border="0" 
src="http://intranet.neath-porttalbot.gov.uk/testpages/itnet/images/itdldivider.gif"; 
width="566" height="12"></td>
  </tr>
</table>
  </CFOUTPUT>
<table border="0">
  <tr>
    <td valign="top">
      <!--- If Previous is true, display the previous link. --->
      <cfif Previous>
        <cfoutput>
          <a 
href="previousnext.cfm?StartRow=#PreviousStart#&PageNum=#DecrementValue(PageNum)#<cfif 
IsDefined("Keyword")>&Keyword=#URLEncodedFormat(Keyword)#</cfif>">&lt;&lt;&nbsp;Previous</a>
        </cfoutput>
      <cfelse>
        &nbsp;
      </cfif>
    </td>
    <cfloop from="1" to="#NumPages#" index="ThisPage">
      <cfoutput>
        <cfif ThisPage IS PageNum>
          <td>#ThisPage#</td>
        <cfelse>
          <cfset PageNumStart=(((ThisPage - 1) * OnEachPage) + 1)>
          <td><a href="linksdetail.cfm?StartRow=#PageNumStart#&PageNum=#ThisPage#<cfif 
IsDefined("Keyword")>&Keyword=#URLEncodedFormat(Keyword)#</cfif>">#ThisPage#</a></td>
        </cfif>
      </cfoutput>
    </cfloop>
    <td valign="top">
      <!--- If Next is true, display the previous link. --->
      <cfif Next>
        <cfoutput>
          <a 
href="linksdetail.cfm?StartRow=#NextStart#&PageNum=#IncrementValue(PageNum)#<cfif 
IsDefined("Keyword")>&Keyword=#URLEncodedFormat(Keyword)#</cfif>">Next&nbsp;&gt;&gt;</a>
        </cfoutput>
      <cfelse>
        &nbsp;
      </cfif>
    </td>
  </tr>

</table><p>
    <cfelse> 

No results returned 

</cfif> 
    

<P>&nbsp;</P>


<P>&nbsp;</P>


<P>&nbsp;</P>
</table>


</body>
</html>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to