My suggestions are:

To illustrate the last point, here's what I mean. Suppose you have the table:

create table Names ( the_key int PRIMARY KEY, last_name varchar(32), first_name varchar(32) )
Now if you want to present the names, you might have a bit of code something like:

# Setup code my $SortField = 'last_name'; # could be 'first_name' my $Page = ''; my $PageSize = 50; <<SNIP SNIP SNIP SNIP SNIP>> # Get the page of data my $SQL = "SELECT first_name, last_name " . "FROM Names " . "WHERE $SortField >= '$Page' " . "ORDER BY $SortField " . "LIMIT $PageSize "; my $results = $db->selectall_arrayref($SQL);
Then in your code, when the person hits the NEXT PAGE button, you simply set $Page to the value of the last $SortField value in your current page. (To move in reverse, have mySQL sort the data in reverse and use the same logic. But after you get your results, reverse the results array so you don't confuse your user.

...roboticus


In reply to Re: Viewing data one page at a time by roboticus
in thread Viewing data one page at a time by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.