Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: View 100 then click for rest

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


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 21: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
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2025-04-20 10:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.