in reply to Re: Looping through database query to send emails is taking too long
in thread Looping through database query to send emails is taking too long
It's a MYSQL database with maybe 100 records. The script loops through and sends an email to records that have notifications set to yes
BTW, I just thought of something. Maybe my code is off. I have 2 email fields in each database records, (email, email2). Each email field can have a notification set or not. I'm looping through twice, maybe that's the problem.
$SQL = "select * from $resident_info_table where email!='' and email_a +lert = 'yes' order by ID desc"; &Do_SQL; while ($pointer=$sth->fetchrow_hashref) { $recipient = $pointer->{'email'}; &send_email; } $SQL2 = "select * from $resident_info_table where email2!='' and email +2_alert = 'yes' order by ID desc"; &Do_SQL2; while ($pointer2=$sth2->fetchrow_hashref) { $recipient = $pointer2->{'email'}; &send_email; }
Is there a way to do both queries in one sql search?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Looping through database query to send emails is taking too long
by BrowserUk (Patriarch) on Jul 21, 2015 at 05:52 UTC | |
|
Re^3: Looping through database query to send emails is taking too long
by vinoth.ree (Monsignor) on Jul 21, 2015 at 05:53 UTC | |
by htmanning (Friar) on Jul 21, 2015 at 06:07 UTC | |
by Anonymous Monk on Jul 21, 2015 at 07:03 UTC |