Lost Password?

Go Back   CodeCall Programming Forum > Web Development Forum > Perl

Perl Discussion for the PERL language - Practical Extraction and Reporting Language, is a programming language often used for creating CGI programs.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-10-2008, 02:30 AM
hhheng hhheng is offline
Newbie
 
Join Date: Nov 2007
Posts: 3
Rep Power: 0
hhheng is on a distinguished road
Default 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:

Quote:
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:

Quote:
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:

Quote:
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 02:57 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 03-11-2008, 02:22 AM
KevinADC KevinADC is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 87
Rep Power: 6
KevinADC is on a distinguished road
Default 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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie questions regarding inputing a sentence Emir C and C++ 3 12-29-2007 06:21 PM
.htaccess directory listing and error pages dirkfirst HTML Programming 2 10-19-2007 04:07 PM


All times are GMT -5. The time now is 12:53 AM.

Contest Stats

dargueta ........ 93.00000
John ........ 87.50000
Xav ........ 70.00000
MeTh0Dz ........ 20.00000
gaylo565 ........ 18.00000
Johnnyboy ........ 3.00000

Contest Rules

Ads