htmanning has asked for the wisdom of the Perl Monks concerning the following question:
I've setup a bademails table that we can store bounced emails. I want to check that table, then remove any emails from the alerts table. Here's what I have, but something is wrong with my loop. It stops after finding one record.
###### $SQL = "Select * from bademails ORDER BY ID DESC"; &Do_SQL; while ($pointer = $sth->fetchrow_hashref) { $bademail = $pointer->{'email'}; $SQL2 = "Select * from $alertstable where email LIKE '%$bademail%' +"; &Do_SQL2; $item = $pointer2->{'type'}; $alertype = $pointer2->{'alertype'}; $emaillist = $pointer2->{'email'}; $ID = $pointer2->{'ID'}; @emails = split /~~~/,$emaillist; foreach $address (@emails) { print "$ID<Br>\n"; $elist = ""; if ($address eq $bademail) { $elist = $elist . $address . "~~~"; } } $SQL3 = "UPDATE $alertstable SET email='$elist' WHERE type='$item' +and alerttype='$alerttype'"; &Do_SQL3; print "Updated $ID<Br>\n"; } # end while #######################
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Comparing 2 databases
by helphand (Pilgrim) on Mar 12, 2006 at 05:23 UTC | |
|
Re: Comparing 2 databases
by helphand (Pilgrim) on Mar 12, 2006 at 00:27 UTC | |
by htmanning (Friar) on Mar 12, 2006 at 00:31 UTC | |
by helphand (Pilgrim) on Mar 12, 2006 at 01:33 UTC | |
by htmanning (Friar) on Mar 12, 2006 at 04:23 UTC |