very very quick question

Discussion in 'PHP' started by oo7ml, Aug 27, 2008.

  1. #1
    Hi, just a quick question

    What does the 0,5 mean in the following statement:

    SELECT name FROM users ORDER BY date DESC LIMIT 0,5
    PHP:
    I know it means show 5 only but why can't we just say LIMIT 5 (what is the 0 for - does it mean start counting from the very first row)

    thanks in advance
     
    oo7ml, Aug 27, 2008 IP
  2. Dman91

    Dman91 Peon

    Messages:
    46
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Yes you have got that right, syntax is like LIMIT $offset, $limit where $offset is the record you wanna start from for lets say 20 and $limit is the no of records it would show, lets say 10 so LIMIT 20, 10 would start listing records from id 20 and show 10 records. I hope this clears up.
     
    Dman91, Aug 27, 2008 IP
  3. oo7ml

    oo7ml Well-Known Member

    Messages:
    656
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #3
    yep, cool, thanks
     
    oo7ml, Aug 27, 2008 IP
  4. lillypok

    lillypok Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    yes, that's right
     
    lillypok, Aug 27, 2008 IP