Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

prev/next records in mysql & php

  • 23-02-2005 04: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, Registered Users 2 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