Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Answer: How to display from X to Y records using DBI?

( #9813=categorized answer: print w/ replies, xml ) Need Help??

Q&A > database programming > How can I retrieve records X to Y using DBI? contributed by chromatic

You could use the SQL command LIMIT: SELECT * from presidents WHERE terms > 2 LIMIT 10; You can also use the DBI method fetchall_arrayref(), which will return a reference to a list of rows. Use an array slice to get at the ones you want:
# prepare and execute statement my $array_ref = $sth->fetchall_arrayref(); # we want 0 through 20 foreach my $row (@$array_ref[0 .. 20]) { # do something }

Comment on Answer: How to display from X to Y records using DBI?
Select or Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2014-09-22 02:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (177 votes), past polls