Re: Batch Coding Help Please

From: Date: Mon, 25 Jun 2001 11:50:21 +0000
Subject: Re: Batch Coding Help Please
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-55133@lists.php.net to get a copy of this message
Hi, I do the following in a similar case: - I have a table with the emails to send (the addresses) - I run a PHP script as a cronjob every X minutes (15 in my case) - the script sends up to 1000 e-mail and delete the corresponding entry from the table for each e-mail sent (you may want to simply mark as "sent" an address if it is the case). This work fine for me. Cheers, Gianluca Kac> I am building a custom e-mailer for one of my websites using PHP and MySQL, I Kac> know there are loads out there already but my goal here is to learn this Kac> coding myself so I can modify it to my needs as and when they change. Kac> My list only has around 5000 subscribers at the moment and I have heard that Kac> with large lists like this it is ideal to batch send the emails. So my Kac> question is how do you batch code? Kac> This is the code I have in place at the moment.... Kac> $query=mysql_db_query($dbase,"SELECT * FROM Subscribers, Members where Kac> Subscribers.ListID='$ID' and Members.MID=Subscribers.MemberID"); Kac> $num_rows=mysql_num_rows($query); Kac> for ($i=0; $i<$num_rows; $i++) Kac> { Kac> mysql_data_seek($query, $i); Kac> $array=mysql_fetch_array($query); Kac> $Email="$array[Email]"; Kac> mail($Email, $MsgTitle, "$Message\n\n\n$Content", $Header); Kac> } gianluca.baldo@bcninedita.com BcnInédita EURO RSCG INTERACTION www.bcninedita.com Planella, 39 08017 Barcelona Tel.34 932 531 950 (directo 93 253 19 53) Fax. 34 932 114 546

« previous php.general (#55133) next »