Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

In MySQL I have a column called id, and its unique so each has there own, Say one row was 5 and the other was 6 and the other was 7,8,9 ...

Now im in row five but how would I get the row under it, if I didnt know what the row number was

Replies are listed 'Best First'.
Re: MySQL finding other rows
by andrew (Acolyte) on Jul 21, 2002 at 17:48 UTC
    $sth = $dbh->prepare("SELECT * FROM poll WHERE id < '5' LIMIT 0, 1") Thats how I would do cause you would get the first result thats under five.
      I just got done doing this :)
        ahh, thats was bad here
        $sth = $dbh->prepare("SELECT * FROM poll WHERE id < '$id' ORDER BY 'id +' DESC LIMIT 0, 1");