Closed Thread
Results 1 to 2 of 2

Thread: Newbie questions: how to show a listing in pages

  1. #1
    hhheng is offline Newbie
    Join Date
    Nov 2007
    Posts
    8
    Rep Power
    0

    Newbie questions: how to show a listing in pages

    I'm showing a directory listing in one page now, but I want to show it in pages.

    Currently I'm working like this:

    gtsee.com/cgi-bin/nph-dirsub.pl?invoice=invoices/merchant_invoice_999999
    and the script for showing the listings are:

    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:

    gtsee.com/cgi-bin/nph-dirsub.pl?invoice=invoices/merchant_invoice_999999?page=x
    Among this x=1, 2, 3, 4, 5, 6, etc.
    And I tried this to display in several pages but not working:

    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;
    Can anybody help me for this issue?
    Last edited by hhheng; 03-10-2008 at 12:57 AM.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    KevinADC is offline Programmer
    Join Date
    Jan 2007
    Posts
    125
    Rep Power
    0

    Re: Newbie questions: how to show a listing in pages

    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.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. event listing
    By azoqup in forum PHP Development
    Replies: 5
    Last Post: 08-04-2010, 10:21 AM
  2. Image Listing/File Listing
    By brokenbylaw in forum PHP Tutorials
    Replies: 0
    Last Post: 03-26-2010, 01:25 PM
  3. Replies: 12
    Last Post: 03-15-2008, 04:34 AM
  4. Replies: 3
    Last Post: 12-29-2007, 04:21 PM
  5. .htaccess directory listing and error pages
    By dirkfirst in forum HTML Programming
    Replies: 2
    Last Post: 10-19-2007, 02:07 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts