Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-03-29 16:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found