I'm showing a directory listing in one page now, but I want to show it in pages.
Currently I'm working like this:
and the script for showing the listings are:gtsee.com/cgi-bin/nph-dirsub.pl?invoice=invoices/merchant_invoice_999999
my $sql=SELECT id, name, url FROM free_dirs;
my ( $id, $name, $url) = @{$db_row}{qw/id name url};
print " " $id " " $name " " $url;
Now I want to show the listings in pages since there are thousands of listings in the database. So it shall like this:
And I tried this to display in several pages but not working:gtsee.com/cgi-bin/nph-dirsub.pl?invoice=invoices/merchant_invoice_999999?page=x
Among this x=1, 2, 3, 4, 5, 6, etc.
Can anybody help me for this issue?my $max_listings = 200;
#$tmp is the total listings in the database
my $total_pages = $tmp/$max_listings;
my $page = $query->param('page');
if($page = "") $page = 1;
my $start = ($page - 1) * $max_listings;
my $sql=SELECT id, name, url FROM free_dirs LIMIT $start, $max_listings;
Last edited by hhheng; 03-10-2008 at 12:57 AM.
You have replies on one or two other forums to this question, and those replies would be the same that I would have suggested so I am not going to suggest anything here.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks