GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 03-Jul-2006, 22:24
Blake's Avatar
Blake Blake is offline
Member
 
Join Date: Nov 2005
Posts: 172
Blake will become famous soon enough

email list script timing out


I wrote the following PHP script to send out mass emails for my band (we're not spamming people, they only go out to people who add their emails to the list). The email list is stored in a myql database. This script below (with sensitive information blanked out) accesses the database and sends out an email to everyone on the list. The problem is, sometimes the browser times out before the while loop completes. The list is only getting longer too. Is there a better way to do this? I'm just wondering if someone can point me in the right direction. Thanks.

PHP Code:

include('mailhead.inc');
    
    define ('DB_USER', '********');
    define ('DB_PASSWORD', '********');
    define ('DB_HOST', 'mysql');
    define ('DB_NAME', 'blfoster-render');

    $dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD);
    mysql_select_db (DB_NAME);
    
    $query = "SELECT    email_address AS dr FROM emails ORDER BY email_address ASC";
    $result = @mysql_query($query);

    while ($row = 
    mysql_fetch_array($result,
    MYSQL_NUM))
    {
        mail( $row[0], $subject, $message, "From: news@render-band.com" );
        echo '<br>mailed to ' . $row[0];
    } 


  #2  
Old 18-Aug-2006, 08:46
TreyAU21's Avatar
TreyAU21 TreyAU21 is offline
Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 116
TreyAU21 has a spectacular aura aboutTreyAU21 has a spectacular aura about

Re: email list script timing out


I've accomplished the same functionality in the past with great sucess using CRON to send out daily/weekly/monthly newsletters... however, if you're not necessarily sending newsletters out at a fixed time, you could run the script from the command prompt... php SCRIPT.php.

Try that... however, if you want everything to be accessible from a browser, I'd have to think about it. Approx how many emails is this thing sending out?
__________________
If practice makes perfect and nobody's perfect... why practice?

Homepage: http://www.treywhite.com
Blog: http://www.treywhite.com/blog.php
Web Design Company: http://www.ewebproductions.com
 
 

Recent GIDBlogLast Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bulk Email hosting *** .com Bullet proof hosting additional2 Web Hosting Advertisements & Offers 1 20-May-2007 13:55
[Include] Doubly-linked List dsmith C Programming Language 6 14-Apr-2006 13:12
linked list error message Krandygrl00 CPP / C++ Forum 4 22-Jun-2005 14:13

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 08:27.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.