WEB Mysql Crew: help with paging

Discussion in 'OT Technology' started by brds, Jun 3, 2009.

  1. brds

    brds OT Supporter

    Joined:
    Jun 26, 2006
    Messages:
    17,645
    Likes Received:
    15
    Location:
    Atlanta
    I'm writing some paging code for my new project. There will be 20 results per page (5 rows of 4). Let's say i have 25 items in the DB. Instead of querying for all 25 and extracting the last five for page 2, is there a way i can query for something like this:

    :dunno:


    *Hope that was clear enough*

    Thanks! :wiggle:
     
  2. CrazyInteg

    CrazyInteg Honda-Acura.net OG

    Joined:
    Dec 30, 2000
    Messages:
    12,205
    Likes Received:
    3
    Location:
    Omaha
    I'm pretty sure you cant do a query like what you're saying, but there might be some advanced stuff you could do that I'm not aware of.

    What's your concern here? Too much data to keep stored? Too many columns in the table? Why don't you just load all 25 results into memory?
     
  3. brds

    brds OT Supporter

    Joined:
    Jun 26, 2006
    Messages:
    17,645
    Likes Received:
    15
    Location:
    Atlanta
    I'm just concerned about loading thousands of entries when only 20 are needed (the original 25 was just an example.) Seems like loading all of them simply to throw most of them away is a big time consumer.
     
  4. TurkeyChicken

    TurkeyChicken New Member

    Joined:
    Jun 26, 2003
    Messages:
    42,913
    Likes Received:
    0
    Location:
    Albuquerque, NM
  5. brds

    brds OT Supporter

    Joined:
    Jun 26, 2006
    Messages:
    17,645
    Likes Received:
    15
    Location:
    Atlanta
  6. TurkeyChicken

    TurkeyChicken New Member

    Joined:
    Jun 26, 2003
    Messages:
    42,913
    Likes Received:
    0
    Location:
    Albuquerque, NM
    don't forget to put your order clause in there... that way you know rows won't jump around.
     

Share This Page