master_2008 has asked for the wisdom of the Perl Monks concerning the following question:
#!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_; <table> <tr> <th>emp_name</th> <th>emp_count</th> </tr> _HEADER_ $sth->bind_col(1,\$col1); $sth->bind_col(2,\$col2); while ($sth->fetch) { print "$col1"; print "$col2\n"; } print "DONE \n"; print <<_FOOTER_; </table> _FOOTER_ $sth->finish; $dbh->disconnect;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI-DBI Connectivity and Output
by shmem (Chancellor) on Nov 24, 2007 at 12:03 UTC | |
|
Re: CGI-DBI Connectivity and Output
by tachyon-II (Chaplain) on Nov 24, 2007 at 12:54 UTC | |
|
Re: CGI-DBI Connectivity and Output
by Cubes (Pilgrim) on Nov 24, 2007 at 13:30 UTC | |
by master_2008 (Initiate) on Nov 24, 2007 at 15:40 UTC | |
by Cubes (Pilgrim) on Nov 24, 2007 at 19:13 UTC |