On Monday 30 October 2000 14:02, Jeff Hoffmann wrote:
> Nikolay Mijaylov wrote:
> > Let say we have a select that returns 100 rows.
> >
> > I can fetch first 25 with simple sql:
> >
> > BEGIN WORK;
> > DECLARE liahona CURSOR FOR SELECT * FROM films;
> > FETCH [FORWARD] 25 IN liahona;
> > CLOSE lia
Hello, Nikolay,
Don't use cursors; instead, use:
" select * from films limit 25 offset 0 ; "
and on the next query:
" select * from films limit 50 offset 25 ; "
and so on. You have to encode the current offset into the NEXT link,
either making it into a button inside a form, with a hidden fie
> "Jeff" == Jeff Hoffmann <[EMAIL PROTECTED]> writes:
Jeff> you can't do that with a cursor, but you can use they mysql-ism
Jeff> called a limit clause. for example, to fetch rows 26-50 from
Jeff> that query, you'd do:
Jeff> select * from films limit 25,26;
Jeff> or
Jeff> select * from files
Nikolay Mijaylov wrote:
>
> Let say we have a select that returns 100 rows.
>
> I can fetch first 25 with simple sql:
>
> BEGIN WORK;
> DECLARE liahona CURSOR FOR SELECT * FROM films;
> FETCH [FORWARD] 25 IN liahona;
> CLOSE liahona;
> COMMIT WORK;
>
> but how I can fetch rows from 26 to 50? I
I hate to be the bearer of bad news, but if you're using PHP and you wanted to fetch
just 25 rows at a time for a single page, and then fetch more when the user clicks on
a NEXT button or link, you're completely out of luck. Each http transaction is
completely separate and so you can't maintai