This was asked in the CB earlier and I made a few attempts but the morning is catching up to me and for some reason I can't think of the way to do this!
I'm pulling records from a database and I need to break it up into managable pages (15 per page for now but I'll change it later if I need). This means page=1 would display items 0-14, page=2 would display 15-29, etc.
my $page = url_param("page");
if ($page)
{
my $per_page = 15;
my $count_low = $per_page - 1;
my $count_high =
}
Something was wrong with my logic in determining what items are expected to be called on that page and this is where I need your help. I need the calculations to determine the first and the last record needed to be printed based on the url_param page number. I know this is easy but I'm making this harder than it has to.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.