List:General Discussion« Previous MessageNext Message »
From:Sasha Pachev Date:June 3 1999 4:25am
Subject:Re: Browsing using Prev, Next
View as plain text  
Derek Lavine wrote:
> Hi
> If I have a table indexed by a particular field, is it possible to
> select an entry and then request the next or previous key (and
> corresponding record) in the table.
> Or do I have to use a cursor.
> In either case would someone mind showing be the basics of the solution.
> I am writing a web based util and I would like to enable the user to
> select a sort order (by selecting an index) and then browser up and down
> the data using Prev and Next buttons.
> Regards
> Derek

You definitely would have to write a script that is smart enough to
remember the state, since HTTP is naturally stateless. To introduce
state tracking, you can either use cookies, or hidden inputs. Your state
variables must remember something about the last record so that you can
go to the previous. You will probably need to use the limit statement (
see manual, look for select syntax).

As far as the user being able to specify the order ( asc or desc ), this
is easily accomplished if the language you are using can concatenate
strings to build a custom query. Perl can do it, so can C, C++ and any
decent language worth using.

Speaking of languages, and unrelated to the question, I have a funny
question for everybody, the answer for which is probably HECK, NO! Has
anybody ever tried to talk to MySQL from COBOL? :)

Sasha Pachev
Browsing using Prev, NextDerek Lavine3 Jun
  • Re: Browsing using Prev, NextBenjamin Pflugmann3 Jun
  • Re: Browsing using Prev, NextSasha Pachev3 Jun
    • Re: Browsing using Prev, NextDon Read5 Jun