#!C:/Perl/bin/perl.exe use DBI; use CGI qw/:standard/; $query = new CGI; $abc = $query->param('first_name'); $dbh = DBI->connect("dbi:DB2:VOTE","","") or die "Can't connect to sample database :DBI::errstr"; $stmt = "SELECT * from VOTE"; $sth = $dbh->prepare($stmt); # $sth->bind_param(1,$abc); $sth->execute(); print "Content-Type: text/html\n\n"; print <<_HEADER_; _HEADER_ $sth->bind_col(1,\$col1); $sth->bind_col(2,\$col2); while ($sth->fetch) { print "$col1"; print "$col2\n"; } print "DONE \n"; print <<_FOOTER_;
emp_name emp_count
_FOOTER_ $sth->finish; $dbh->disconnect;