Here is the script that needs pagination :
#!/usr/local/bin/perl use DBI; use CGI; use strict; use HTML::Template; my $CGI = CGI->new(); my $dbh = dbh(); # connect to db $dbh->do("SET search_path to northwind") or die; # grab the stuff from the database my $sql = qq!SELECT a."OrderID", b."CompanyName" AS "CustomerName", c."FirstName"::text || ' ' ||c."LastName"::text AS "E +mployeeName", a."OrderDate", a."RequiredDate", a."ShippedDate", d." +CompanyName" AS "ShipVia", a."Freight", a."ShipName", a."ShipAddress", a."ShipCi +ty", a."ShipRegion", a."ShipPostalCode", a."ShipCountry" FROM "Orders" a, "Customers" b, "Employees" c, "Shippers" +d WHERE a."CustomerID" = b."CustomerID" AND a."EmployeeID" = c."EmployeeID" AND a."ShipVia" = d."ShipperID" ORDER BY 1 !; my $sth = $dbh->prepare($sql); $sth->execute(); # prepare a data structure for HTML::Template my $rows; push @{$rows}, $_ while $_ = $sth->fetchrow_hashref(); # instantiate the template and substitute the values my $template = HTML::Template->new(filename => 'Orders.tmpl'); $template->param(ROWS => $rows); print $CGI->header(); print $template->output(); $dbh->disconnect(); # connect to database sub dbh { my $dsn = 'DBI:Pg:dbname=northwind;host=localhost'; my $user = 'postgres'; my $pwd = 'postgres'; my $dbh = DBI -> connect($dsn,$user,$pwd,{'RaiseError' => 1}); return $dbh; }
If you need the template code used in this script I will post it. Many thank !!!

In reply to Re^4: How to retain a value passed from another link to a script by terrykhatri
in thread How to retain a value passed from another link to a script by terrykhatri

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.