hi monks,
I have written a smaller script in cgi with dbi but problem is that when i run this script through command prompt then i see the result what is expexted but at browser i am not been able to see the result.please help me get out of this.
Code snippet is as follows:
#!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;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.