in reply to Viewing data one page at a time
Now if you want to present the names, you might have a bit of code something like:create table Names ( the_key int PRIMARY KEY, last_name varchar(32), first_name varchar(32) )
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.# 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);
...roboticus
|
|---|