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.

MySQL SELECT help needed.

Discussion in 'MySQL' started by mgrohan, Dec 5, 2007.

  1. #1
    I'm totally clueless on MYSQL.

    I current have the following SELECT code:
    $aa_query = "SELECT `id`, `title`, `seftitle`, `date` FROM `articles` WHERE `id`<".$r['id']." AND `category`=".$r['category']." ORDER BY `date` DESC LIMIT 5";

    Which is selecting the 5th most recent by date articles by date.
    What code would i need to be able to select the 5th to 10th most recent articles only.

    Thanks.
     
    mgrohan, Dec 5, 2007 IP
  2. codesome

    codesome Peon

    Messages:
    98
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    try:

    $aa_query = "SELECT `id`, `title`, `seftitle`, `date` FROM `articles` WHERE `id`<".$r['id']." AND `category`=".$r['category']." ORDER BY `date` DESC LIMIT 5,5";
     
    codesome, Dec 6, 2007 IP
    mgrohan likes this.
  3. mgrohan

    mgrohan Active Member

    Messages:
    671
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Simple as that! Thanks codesome. :) Rep Added.
     
    mgrohan, Dec 6, 2007 IP