Hi,
Please see my code:
my problem is, i am not facing any error. But total record count is 20 means, i am getting only 1 record as output. I don't know. Why my outer WHILE LOOP is not iterating? Its getting stopped from one output. My SQL statement is correct. I checked it out.Thanks in advance.
Please see my code:
Code:
!c:/perl/bin/perl
use CGI qw(:all);
$empid=param('empid');
print "Content-type: text/html\n\n";
print "<body bgcolor=\"#ffcccc\">";
use DBI;
my $dbh = DBI->connect("DBI:ODBC:aaaa","bbb","cccc") or die "Can not connect: $DBI::errstr\n";
my $sth;
print "<center><table border=1></center>";
print "<tr><th>SlNo</th><th>name</th><th>designation</th><th></th><th>title1</th><th>title2</th></tr>";
$sth=$dbh->prepare("select empname, empdesignation from emp where empid=?");
$sth->execute($empid) or die "Cant execute SQL: $DBI::errstr\n"
while ( @row = $sth->fetchrow_array())
{
$j=$j+1;
[B]Here again, i am calling
$sth=$dbh->....
while()
{
}
[/B]
print "<tr><td>$j</td><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>$row[3]</td></tr>";
}
Comment