I would like to know how I can e-mail database query results. I currently use a similar script as below to display the results in HTML format. Thanks in advance for your help.
#!/usr/bin/perl
require "cgi-lib.pl";
use DBI;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
&ReadParse(*in);
$DBH = DBI->connect("dbi:Oracle:Somedatabase", "Username", "Password");
print &PrintHeader;
$STH = $DBH->prepare("select description, time_add, user_id from products");
$STH->execute;
while (@row = $STH->fetchrow_array) {
print << "EOF";
<div align="center">
<table border="0" width="850" id="table1" cellspacing="1">
<tr>
<td>$row[0]</td>
<td>$row[1]</td>
<td>$row[2]</td>
</tr>
</table>
</div>
EOF
}
$DBH->disconnect;
print &HtmlBot;
#!/usr/bin/perl
require "cgi-lib.pl";
use DBI;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
&ReadParse(*in);
$DBH = DBI->connect("dbi:Oracle:Somedatabase", "Username", "Password");
print &PrintHeader;
$STH = $DBH->prepare("select description, time_add, user_id from products");
$STH->execute;
while (@row = $STH->fetchrow_array) {
print << "EOF";
<div align="center">
<table border="0" width="850" id="table1" cellspacing="1">
<tr>
<td>$row[0]</td>
<td>$row[1]</td>
<td>$row[2]</td>
</tr>
</table>
</div>
EOF
}
$DBH->disconnect;
print &HtmlBot;