Derek Lavine wrote:
> 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.
You definitely would have to write a script that is smart enough to
remember the state, since HTTP is naturally stateless. To introduce
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? :)