Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

prev/next records in mysql & php

Options
  • 23-02-2005 4:34am
    #1
    Closed Accounts Posts: 8,478 ✭✭✭


    my brain doth bork out aloud!

    Anyway - what I'm trying to do is properly implement a "previous record / next record". My current setup is done via an URL parameter, where the previous/next record is queried from the database with
    $previous = $newsID - 1;
    $next = $newsID + 1;
    

    Thats fine if you dont plan to delete anything from the mysql db, but of course you will want to. That same table called "news" also contains a datetime function. Can they be compared to give me what I need when the sequence of auto-incremented id's are disjointed? Or is there another way of doing it using the id's ?

    Ta!


Comments

  • Registered Users Posts: 333 ✭✭s4dd


    depending on the amound of records, you could just use a

    select *

    statement and iterate through the resultset?


  • Closed Accounts Posts: 8,478 ✭✭✭GoneShootin


    Got it solved here


Advertisement