1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP+MySQL

Discussion in 'PHP' started by Magina™, Aug 27, 2010.

  1. #1
    Hello guys I have problem retrieving information in database using PHP in MySQL.

    I want to retrieve a specific row up to the the last row.

    like for example:

    I want to retrieve row 10 up to the last row. What query string should I use?
     
    Magina™, Aug 27, 2010 IP
  2. lowridertj

    lowridertj Well-Known Member

    Messages:
    2,882
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    195
    #2
    add id numbers to the table in the mysql and have them auto incremental.

    then call `id` >= '10 in your statement.
     
    lowridertj, Aug 27, 2010 IP
    Magina™ likes this.
  3. Magina™

    Magina™ Active Member

    Messages:
    258
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #3
    thanks for the quick reply buddy! You helped me alot! thank you... :) rep added!
     
    Magina™, Aug 27, 2010 IP
  4. Zeh.

    Zeh. Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Or simply use LIMIT:

    SELECT * FROM blabla WHERE cond='val' LIMIT 10, 10

    The first number is the start and the second is how many rows do you want.
     
    Zeh., Aug 28, 2010 IP
  5. Thorlax402

    Thorlax402 Member

    Messages:
    194
    Likes Received:
    2
    Best Answers:
    5
    Trophy Points:
    40
    #5
    Limit is probably a better way to go. If you end up deleting rows from the beginning for whatever reason then Limit will still start from the new tenth row where as the other method will still just look at the id.
     
    Thorlax402, Aug 28, 2010 IP