Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Success: The first page prints in order I specify nicely (it prints the 20 newest images stored into the database).
Failure: When you reach over 20 images and you use the url_param, the images on this new page aren't in the right order.
Example: If I have 23 images, I'd type in script.pl?page=2 and it SHOULD print the first three images (but it doesn't).
Can someone check the math to see if I'm going about it correctly?
my $page = url_param('page'); my $top = -($page * 20); my $bottom = $top + 19; if ($page ne "") { for ( grep defined($_), ( reverse keys %upload )[ $top .. $bottom ] ) +{
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: math mistake?
by sulfericacid (Deacon) on Jul 27, 2003 at 07:57 UTC | |
|
Re: math mistake?
by blokhead (Monsignor) on Jul 27, 2003 at 08:17 UTC | |
|
Re: math mistake?
by vbrtrmn (Pilgrim) on Jul 27, 2003 at 08:53 UTC | |
by Coruscate (Sexton) on Jul 27, 2003 at 17:22 UTC |