Please see my code:
Expand|Select|Wrap|Line Numbers
- !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;
- Here again, i am calling
- $sth=$dbh->....
- while()
- {
- }
- print "<tr><td>$j</td><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>$row[3]</td></tr>";
- }