Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jul 2004
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Limiting the number of database entries shown..

    i have a database at http://www.startbar.co.uk/coursemanager/courses.asp

    it shows a list of course entries.

    how can i create a seperate section to go on another page with the 'next five courses' so it will only show the next 5 entries?

    like a 'headlines' system on a news script.

    thanks

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    run a google or a search here or at www.hotscripts.com for 'recordset paging' or 'pagination'. Plenty of tutorials and examplecode for whatever db-format you are using, will popup
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #3
    Regular Coder
    Join Date
    Jul 2004
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts
    actaully i meant like just showing the first five entries of a database.

    i ie..

    list of ten

    1 to 10

    and ONLY showing 1, 2, 3, 4, 5

    and thats it. the first five!

    any ideas?

  • #4
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i don't realy understand it and you probably didn't look up recordset paging, because with recordsetpaging, you do exactly the same. Only the ofset will be different. If you just need t first 5, then all you need is
    (for Jet DB's --> access or ms server)
    select top 5 your variables from table order by tablesautonumcolumn asc
    (for MySQL)
    select your variables from table order by tablesautonumcolumn asc
    limit 5

    tablesautonumcolumn should be replaced by whatever columns you want to sort on.

    Note: TOP does not discriminate ! So if your values (from tablesautonumcolumn) are 1,2,3,4,5,5,5,5,5,5,,5,5,5,5,5,5,5,5,5,5,5,6,6,6,7,7,7

    then TOP 5 would include 1,2,3,4,5,5,5,5,5,5,,5,5,5,5,5,5,5,5,5,5,5
    LIMIT 5 would just return 1,2,3,4,5
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html


  •  

    Posting Permissions

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