Coldfusion 8

Posted on 2009-04-19
Last Modified: 2013-12-24
Hi, I'm having an issue (lack of knowledge) trying to get Coldfusion to display the correct number of records.

It works fine when there are 4 records but inaccurately when there is less than 4. (Please see attached screen shots).

Any help would be be greatly appreciated.
<!---CFC Database Query starts--->






<!---CFC Database Query Ends--->

<!---Pageable Record Sets Starts--->

<cfparam name="URL.startrow" default="1"/>

<cfset nNextStartRow = URL.startrow +4/>

<cfset nPreviousStartRow = URL.startrow -4/>

<cfset nEndRow  = URL.startrow +3/>

<!---Pageable Record Sets Ends--->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">

<html xmlns="">


	<title>British Forces Foundation: Latest News from the BFF</title>

	<meta http-equiv="content-type" content="text/html; charset=utf-8" />

	<style media="all" type="text/css">@import "css/all.css";</style>

	<script type="text/javascript" src="js/font-size.js"></script>


<body id="news_page">

<!-- page start -->

<div id="page" class="inner1">

  <h1 class="logo"><a href="index.cfm">BritishForcesFoundation</a></h1>

  <!-- content start -->

  <div id="content">

<!---col1 start--->

	<cfinclude template="includes/col-1.cfm">

<!---col1 end--->

<!-- col2 start -->

    <div id="col2">

      <div class="col2-top">

        <div class="col2-bottom inner-col2">

          <h2>Latest News from the BFF</h2>


<!---News Story Div Starts---> 

<cfoutput query="qGetAllNewsInfo" startrow="#URL.startrow#" maxrows="4">

 <!---Alt Row Code--->     

	<cfif qGetAllNewsInfo.CurrentRow mod 2 IS 1>

	<cfset class="fas-box fas">


    <cfset class="fas-box fas-light">


<!--- Alt Row Code--->      


          <div class="#variables.class#">

            <div class="fas-corner">


                <h3>#qGetAllNewsInfo.NewsHeadline#<br><span class="NewsInsertDate">#DateFormat(qGetAllNewsInfo.NewsInsertDate,"mmm, dd, yyyy")#</span></h3>


                <span class="more"><a href="news-full-story.cfm?NID=#qGetAllNewsInfo.NewsStoryID#">Click Here</a> for full story</span> </div>

              <img src="#qGetAllNewsInfo.NewsImageSmall#" alt="" /> </div>







<!---News Story Div Ends---> 



<!---Record Count Starts--->           


    <ul class="disp-menu">

            <li>Displaying #URL.startrow# - #nEndRow# of #qGetAllNewsInfo.Recordcount# articles </li>

<cfif nPreviousStartRow GTE 1>

            <li><a href="#CGI.SCRIPT_NAME#?startrow=#nPreviousStartRow#">Previous</a></li>


           <cfif nPreviousStartRow LT 1>

            <li><a href="#CGI.SCRIPT_NAME#?startrow=#nNextStartRow#">Next</a></li>





<!---Record Count Ends--->             








<!-- col2 -->

<!---col3 start--->

	<cfinclude template="includes/col-3.cfm">

<!---col3 end--->


  <!-- content end -->

  <!---header start--->

<cfinclude template="includes/header-navigation.cfm">

  <!--- header End--->


  <!---Footer start--->

	<cfinclude template="includes/footer-navigation.cfm">

<!--- Footer End--->




<!-- page end -->



Open in new window

Question by:greenchilli
    LVL 27

    Accepted Solution

    change this:
    <li>Displaying #URL.startrow# - #nEndRow# of #qGetAllNewsInfo.Recordcount# articles </li>

    <li>Displaying #URL.startrow# - #min(nEndRow, qGetAllNewsInfo.Recordcount)# of #qGetAllNewsInfo.Recordcount# articles </li>


    Author Closing Comment

    Many thanks for your time and help.

    Kind Regards,

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
    Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
    The purpose of this video is to demonstrate how to connect a WordPress website to Google Analytics. This will be demonstrated using a Windows 8 PC Go to your WordPress login page. This will look like the following: :…
    The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be Log into your Hosting account. IPage will be used for demonstration : Locat…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now