Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2012
    Ontario, Canada
    Thanked 0 Times in 0 Posts

    Multipage View from Database


    I am pulling information from a database and want to view only 8 items on the page and the have Page 1 of xx so when I click Next it will show the next 8 items.

    Does anyone have a good place that I can go and read up on how to achieve this?

  2. #2
    Regular Coder
    Join Date
    Apr 2012
    St. Louis, MO
    Thanked 101 Times in 101 Posts
    Google "pagination".

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  3. #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Sydney, Australia
    Thanked 932 Times in 919 Posts
    Quote Originally Posted by chellert View Post
    Does anyone have a good place that I can go and read up on how to achieve this?
    You really ought to populate that information using whichever server side language you are using to create the pages. It is not something you should be considering using JavaScript for.

    Basically when you do the query on the database one of the pieces of information that you will have available to you will be the number of entries returned in the results. Alternatively if you are going to limit the query to the number of entries that will be displayed on the page you'd do a second database query specifically to count the total results. You'd only need to do this extra call once. You can then pass the information about which page is to be displayed and how many pages there are in total when the previous or next button is pressed to request a new page.
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts