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.
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?