in reply to math mistake?
I use this for a guestbook, the data is sent via get with a simple link.
# number of rows in db, this is actually pulled from the # database, i'll just do 1000 here. my $termNUM = 1000; my $numberset = param('value'); # if no value is passed or if someone passes 0 # this sets it to 1 if ($numberset eq "") { $numberset = 1; } elsif ($numberset eq 0) { $numberset = 1; } $origNUM = $termNUM - 25; # 25 is the entries i want to view per page $termNUM = $rowNUM - (($numberset - 1) * 26); # 26 is the entries plus 1, i guess i could have set a variable, but i +'m lazy
to generate the links, i use a subroutine:
sub Test25 { if ($termNUM < $rowNUM) { print "<div style=\"text-align: left; float: left;\"><a href=\"?va +lue=".($numberset - 1)."\">View Previous 25 Entries</a></div>\n"; } if ($origNUM > 1) { print "<div style=\"text-align: right; float: right;\"><a href=\"? +value=".($numberset + 1)."\">View Next 25 Entries</a></div><BR>\n"; } }
you'll have to modify this a bit for your own use.
--
paul
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: math mistake?
by Coruscate (Sexton) on Jul 27, 2003 at 17:22 UTC |