SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Separate into different pages

    Hi there all PHP/mySql knowers,
    As I'm new in PHP and mySql I need some help.
    For example, I have 99 jokes in my mySql database.
    Now, it's too big to put it into one page. So, how
    can I put those jokes into 5 pages(20 per page).
    There should be links: previous, 1,2,3,4,5, next.

    If someone knows good example/tutorial about that,
    please, let me know

  2. #2
    SitePoint Addict Chris Roane's Avatar
    Join Date
    Jul 1999
    Location
    Helena, MT
    Posts
    287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here you go: http://www.phpbuilder.com/columns/rod20000221.php3

    There are many ways of doing it, but this way is documented, which prevents me from having to rant.

    Hope this helps.

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanx, this looks good

  4. #4
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is there a way of showing the page listings..like


    [prev] [1 2 3 ..... 8 9 10] [next]

    if your database is too long?
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  5. #5
    SitePoint Addict Chris Roane's Avatar
    Join Date
    Jul 1999
    Location
    Helena, MT
    Posts
    287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't understand. Could you rephrase your question?

  6. #6
    SitePoint Evangelist
    Join Date
    Dec 2000
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think what Lyon wants to do is to have links that have something like: Previous Page 1 2 3.. Next Page with each thing being a link. Try reading through Kevin Yank's article, Building a Database-Driven Site Using PHP & MySQL.

    Hope that helps!
    Corbb O'Connor
    Looking for quality website design or database programming?
    Contact me for more information and a FREE quote!

  7. #7
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    He means instead of having:

    Prev 1 2 3 4 5 6 7 8 9 10 11 Next

    Have:

    Prev 1 2 3 ... 9 10 11 Next

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  8. #8
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by seanf
    He means instead of having:

    Prev 1 2 3 4 5 6 7 8 9 10 11 Next

    Have:

    Prev 1 2 3 ... 9 10 11 Next

    Sean
    Yes. Precisely. That means, if you have 500,000 entries in the database....and listing 20 per page....you won't be shown a number sequence from 1 to 25000!

    It could display the first 10 pages, then as you browse from each page...it'll show an additional page and so forth.

    like oif you're on page 1,

    [1 2 3 4 5 6 7 8 9 10]

    if you're on page 2,

    back [2 3 4 5 6 7 8 9 10 11] next

    etc. much like the way search engines handle their query results.
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  9. #9
    SitePoint Evangelist
    Join Date
    Dec 2000
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Part of this concept was covered in issue eleven of the SitePoint Tech Times.

    Here's the code:
    PHP Code:
    Rstart intval($start); // Make sure $start is an integer
    $sql "SELECT * FROM Jokes ORDER BY Title LIMIT $start, 20";
    $results mysql_query($sql); 
    Then, you would have something that would print the links. Look at http://www.webmasterbase.com/article.php/228/1039 if you're confused.
    Corbb O'Connor
    Looking for quality website design or database programming?
    Contact me for more information and a FREE quote!

  10. #10
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes..I've already done that....but thats not what i meant....

    (quote previous post)
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  11. #11
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anyone figure out how to do this? i'm interested in how.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*


Bookmarks

Posting Permissions

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