CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: DBI:
Read from database and mail the out put

 



coolkille
Novice

Jul 22, 2004, 4:10 AM

Post #1 of 2 (4845 views)
Read from database and mail the out put Can't Post

Hi i have this code.
I want to mail the resualt in yhe end off this script.
I dont know how to handel the output from database .
Pleas i need help


use warnings;
use DBI;
DBI->trace(1,"trace.txt");


$dataBase="test";
$login="root";
$password="";
$database_params = "DBI:mysql:$dataBase";


my $dbh = DBI->connect($database_params, $login, $password) or die DBI->errstr;

my $sth = $dbh->prepare("select * from tickets where mail = 0");
$sth->execute();
while
(my $ref = $sth->fetchrow_hashref())
{
print "Hittade en rad: ticket = $ref->{'ticket'}, subject = $ref->{'subject'}\n";
}


$sth->finish(); # Disconnect from the database.
$dbh->disconnect();



davorg
Thaumaturge / Moderator

Jul 23, 2004, 1:36 AM

Post #2 of 2 (4838 views)
Re: [coolkille] Read from database and mail the out put [In reply to] Can't Post

Does this help?

How do I send mail?

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives