Hi, I have a working DBI::Oracle script that I am now trying to get
CGI.pm to HTML-ize the output of, My problem is in the table statement
how can I get the output of the while statement to be in the table? I
have just about beat myself silly trying to figure this out.

SCRIPT:

#!/usr/bin/perl
#
use strict;
use DBI;
use CGI qw(:standard escapeHTML);

#
# Set some environment variables
#
$ENV{ORACLE_HOME} = '/opt/oracle/9i';
my ($count, $dbh, $host, $pass, $port, $r_au, $sql, $sid, $sth, $user,
@row);

#
# my declarations
#
$host = 'host=HOSTNAME';
$pass = 'PASSWORD';
$port = 'port=PORT';
$sid  = 'sid=SID';
$user = 'USER';

$dbh = DBI->connect("dbi:Oracle:$host;$sid;$port", $user, $pass,
                        { RaiseError => 1, AutoCommit => 0}
                        ) || die "Database connection not made:
$DBI::errstr";

$sql = qq{ select r.au_number, count(distinct r.subj_id)
              from t_request r, t_certificate c
              where r.req_status_id=9  and
                (r.req_id=c.req_id) and
                c.cert_status_id=1
              group by au_number };

$sth = $dbh->prepare($sql);
$sth->execute();
$sth->bind_columns(undef, \$r_au, \$count);

print header(), start_html("BEST CertMan results");

print h1("Results"),
        table({-border=>'1', -width=>'20%'},
                Tr({-align=>'LEFT', -VALIGN=>'TOP'},
                        th({-width=>'30%', -bgcolor=>'#CCCCCC'}, "AU"),
                        th({-bgcolor=>'#AAAAAA', -fontcolor=>'#FFFFFF'},
"Certs"),
                ),

        while (@row = $sth->fetchrow_array())
        {
                        Tr( td( [EMAIL PROTECTED] ));
        }

);

$sth->finish();

# Disconnect from Oracle
$dbh->disconnect;

print "<a href=\"../\">Return</a>\n";

print end_html();


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to