I wouldn't mind them waiting if I could provide a "please wait" or appropriate graphic. When they click SEND, the script takes 10 seconds to cycle through the database.

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?


In reply to Re^2: Looping through database query to send emails is taking too long by htmanning
in thread Looping through database query to send emails is taking too long by htmanning

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.