Gossamer Forum
Home : General : Perl Programming :

Disconnecting quick....

Quote Reply
Disconnecting quick....
Hello,

I have a MySQL Db that is holding over 100, 000 members.

I have made a mailing list program to send out email to all the members.

I have done the following....


Code:


my($query) = "SELECT email FROM members";

my($sth) = $dbh->prepare($query);

$sth->execute || die("Could not execute!");



if(fork()) {

print "Mail sent....";

}

else {

close (STDOUT);

while(@row = $sth->fetchrow) {

#Fire off 100, 000 the e-mails here.....#

} #---End the WHILE Loop---#

$sth-finish;

$dbh->disconnect;

}


This takes 2 hours to send...... so my question is
How can i finsih and disconnect from MySQL before the fork() ?

Hope you can help,

ZimmY