
coolkille
Novice
Jul 22, 2004, 4:10 AM
Post #1 of 2
(7255 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();
|