use DBI; use DBD::DB2::Constants; use DBD::DB2; use CGI qw/:standard/;
$val = param("PERMT");
print header;
$dbh = DBI->connect("dbi:DB2:*LOCAL") or die;
$stmt = "SELECT * FROM T40CGI.INS WHERE INSPMT = '$val'";
$sth = $dbh->prepare($stmt) or die "prepare got error " . $dbh->err;
$sth->execute() or die "execute got error" . $dbh->err;
# output the first row of the table with column headings print '<table border=1>'; print '<tr><td><b>Permit#</b></td>'; print '<td><b>Type</b></td>'; print '<td><b>Date</b><t/td>'; print '<td><b>Result</b></td></tr>';
# output each row of table (each matching record)
while($data = $sth->fetchrow_hashref){
print qq(<tr>\n);
print qq(<td>$data->{INSPMT}</td>\n);
print qq(<td>$data->{INSDSC}</td>\n);
print qq(<td>$data->{INSDTE}</td>\n);
print qq(<td>$data->{INSRST}</td>\n);
print qq(<td><a href=showdetl?PERMT='$data->{INSPMT}'&TYP='$data->{INSTYP}'>
Details</a></td>\n);
print qq(</tr>\n);
}
print '</table>';
print '<br>';
print '<a href="http://66.12.223.253/gtpermitperl.html">Click here to see the PERL
source</a>';
print '</body></html>';