ColdFusion
  Home arrow ColdFusion arrow Creating NextPrev Link in Cold Fusion
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
COLDFUSION

Creating NextPrev Link in Cold Fusion
By: Shiju Rajan
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 46
    2004-03-31

    Table of Contents:
  • Creating NextPrev Link in Cold Fusion
  • Calculate the Offset and Limit Rows
  • Pass More Parameters to Create/Prev Link

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Creating NextPrev Link in Cold Fusion


    (Page 1 of 3 )

    Creating a Next/Prev link for query results in Cold Fusion is very easy with <cfloop> tag. Passing parameters to Start row and End row limits the record display in the specified range. Almost all of our database- driven applications require paging of query results. It might be handy if we had a custom tag or script written already. Just what we need is to extend that code wherever we want to place the paging and then change a few parameters.  In this article, I show you how we can create Cold Fusion database query results with "Next 1 2 3 4... Prev" links.

    Using <cfquery> tag

    First we need to write a select statement to pull the data from the database. Cold Fusion uses <cfquery> tag to execute database commands.  You may need to set up a data source name in the Cold Fusion administrator panel/ODBC Data sources to make a connection to the database.  If you are using a shared server, you may ask your server administrator to set up one data source name for you.

    I’m using a test table name called 'employee' to explain the paging example.


    <!--- query for pulling employee details --->
    <cfquery name="q_fetch" datasource="mydsn"
    select id
    namedept from employee
    </cfquery>

    When we run this query through a Cold Fusion page it creates a query object with some return information. The return object consists of recordCount, currentRow and  columnList variables. recordCount gives us the number of records returned by the query.

    If you want to see the output of query results, use <cfdump var=”# q_fetch #”>. This <cfdump> tag is very useful for debugging purposes.

    More ColdFusion Articles
    More By Shiju Rajan


     

    COLDFUSION ARTICLES

    - How to Access a SQL Anywhere Database with C...
    - CFXML: Probing XMLDOM in ColdFusion
    - Creating a Web Service with ColdFusion: the ...
    - CFAjax: What it is and How to Use it
    - Querying SQL 2000 Server from ColdFusion
    - Introduction to ColdFusion Markup Language, ...
    - Introduction to ColdFusion Markup Language
    - Databases and Dreamweaver MX 2004, concluded
    - Databases and Dreamweaver MX 2004
    - Welcome to Coldfusion MX 6.1, concluded
    - Welcome to Coldfusion MX 6.1
    - What You Must Know About ColdFusion Flow-Con...
    - What You Must Know About Operators in ColdFu...
    - Everything You Must Know About ColdFusion Va...
    - My First Application on ColdFusion MX Server







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway