use strict;
use DBI;
my $host = "localhost";
my $port = "3306";
my $driver = "mysql";
my $database = "mysql";
my $dsn = "DBI:$driver:database=$database:$host:$port";
my $username = "root";
my $password = "*******";
my $dbh = DBI->connect($dsn, $username, $password) or die $DBI::errstr;
my $sth = $dbh->prepare("select host, user from user");
$sth->execute();
print "Content-type:text/html\r\n\r\n";
print '<html>';
print '<head>';
print '<title>cgi test </title>';
print '</head>';
print '<body>';
print '<table >';
while(my @row = $sth->fetchrow_array()){
print "<tr>";
print '<td>'.join('</td><td>', @row)."</td>";
print "</tr>";
}
print '</table>';
print '</body>';
print '</html>';
$sth->finish();
$dbh->disconnect();