Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Perl Monk, Perl Meditation
 
PerlMonks  

Re: View 100 then click for rest

by lhoward (Vicar)
on Jul 27, 2000 at 16:54 UTC ( [id://24700]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to View 100 then click for rest

To implement this you will need to use some sort of counting logic in your element printing logic. The following may not be actually functional, but can act as an starting point for your code.
my $min=... or 0; my $max=$min+100; my $row=0; while(@r=$sth->fetchrow()){ if(($row>=$min)&&($row<$max)){ #print some data } $row++; } $sth->finish(); if($row>$max){ # print next link w. "min=$max" }

Replies are listed 'Best First'.
RE: Re: View 100 then click for rest
by le (Friar) on Jul 27, 2000 at 17:00 UTC
    Nice, but why return the full set, when you're only interested in some columns?
    my $offset ||= 0; my $max = 100; my $sth = $dbh->prepare("SELECT ... LIMIT ?,?"); $sth->execute($offset, $limit);
      Not all databases support "LIMIT" as part of the SQL language. I agree that if your DB does support LIMIT then you should use it, but if you want a truly DB independant solution (much as DBI is database independant) you should avoid LIMIT and other not-widely supported extensions.
        just out of curiosity... what database packages don't support limit?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://24700]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.