Current location: Hot Scripts Forums » Programming Languages » Perl » Pagination Syntax


Pagination Syntax

Reply
  #1 (permalink)  
Old 09-28-06, 05:13 PM
rugrat15834 rugrat15834 is offline
New Member
 
Join Date: Sep 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Question Pagination Syntax

Hi, I have searched high and low for a pagination script to use with perl and have only been able to find information in php. Does anyone know of a place to get such a script--it will be used with mysql(also a new subject for me) Below is a copy of what I have so far. Thanx====Dave
Code:
#! perl
require "cgi-lib.pl";
&ReadParse;
print&PrintHeader;

use CGI::Carp qw(fatalsToBrowser);
use DBI;

$dsn="address_book";
$user="sightseer";
$password="00934100";

print"<table bgcolor=\"black\"border=\"1px\"cellspacing=\"4px\"cellpadding=\"10px\"bordercolor=\"\#ff0000\"align=\"center\"width=\"75%\">\n";

$dbh= DBI->connect("DBI:mysql:$dsn","$user","$password") || 
  die "Got error $DBI::errstr when connecting to $dsn\n";

#$sth=$dbh->prepare("select fame,lame,address,city,state,zip_code,zip_code_ext,area_code,exchange,phone,phone_ext,email from contacts");
$sth=$dbh->prepare("select fame,lame,address,city,state,zip_code,zip_code_ext,area_code,exchange,phone,phone_ext,email from contacts order by fame desc");

$sth->execute();
$i = 0;#alt color line one
while($ref=$sth->fetchrow_hashref()){

$bgcolor = ($i++ & 1) ? '#f0f0f0' : '#ffffce'; #alt color line two

print "<tr bgcolor='$bgcolor'>\n";
print"    <td border=\"6px\"bordercolor=\"gold\">\n";

print"First Name: $ref->{'fame'} <br />\n";
print"Last Name: $ref->{'lame'} <br />\n";
print"Address: $ref->{'address'} <br />\n";
print"City: $ref->{'city'} <br />\n";
print"State: $ref->{'state'} <br />\n";
print"Zip Code: $ref->{'zip_code'} $ref->{'zip_code_ext'}<br />\n";
print"Telephone: $ref->{'area_code'} $ref->{'exchange'} $ref->{'phone'} $ref->{'phone_ext'} <br />\n";
print"Email: $ref->{'email'} <br />\n";

print"    </td>\n";
print"  </tr>\n";

}
print"</table>\n";
So far all I have managed to do is to come up with alternating colors.

Last edited by nico_swd; 09-28-06 at 05:51 PM. Reason: Please use [code] wrappers when posting code.
Reply With Quote
  #2 (permalink)  
Old 09-28-06, 05:46 PM
Drunken Perl Coder Drunken Perl Coder is offline
Wannabe Coder
 
Join Date: Aug 2006
Posts: 110
Thanks: 0
Thanked 0 Times in 0 Posts
Reply With Quote
  #3 (permalink)  
Old 09-28-06, 06:30 PM
rugrat15834 rugrat15834 is offline
New Member
 
Join Date: Sep 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
What next

I appreciate the leading to cpan but now that I have the modules what do I do?
Reply With Quote
  #4 (permalink)  
Old 09-28-06, 06:36 PM
Rando Rando is offline
Newbie Coder
 
Join Date: Sep 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
perldoc Data:age
__________________
Full root access starting at $7.95/mo VPSLink
Reply With Quote
  #5 (permalink)  
Old 09-28-06, 10:24 PM
Drunken Perl Coder Drunken Perl Coder is offline
Wannabe Coder
 
Join Date: Aug 2006
Posts: 110
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by rugrat15834
I appreciate the leading to cpan but now that I have the modules what do I do?
Read the module documentation and figure out how to incorporate it into your existing script/program. Usually you install modules before using them. Did you install one of the modules?
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax Error Help eventone PHP 1 07-04-06 04:15 PM
pagination pumpernickles pilch PHP 0 05-17-06 11:24 AM
MySQL Syntax error gigafare PHP 4 04-19-06 02:03 AM
Pagination Problem lppa2004 PHP 1 03-24-06 07:54 PM
Can't find error in sql syntax. Dr.Jamescook PHP 7 06-14-05 11:45 AM


All times are GMT -5. The time now is 04:42 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.