Dynamic Newsletter
Posted: Thu Feb 01, 2007 1:29 pm
pickle | Please use
Does anyone know of a better way?
Should I just process them in smaller batches? If so, what seems to be a reasonable number of users to loop through at a time?
Thanks for any help!
Philip
pickle | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello all,
I'm building a job listings website for a client. I'm building a feature to send weekly emails to registered users of new jobs that meet their criteria. It's a small niche market, but I would expect the list to be 1,000-5,000 within 6 months.
The problem is that I'm worried about crashing the script/server if I do a query to gather the listings for each name on the list, something like...
[syntax="php"]$sql = mysql_query ("select criteria, email from users");
while ($row = mysql_fetch_array($sql))
{
$sql2 = mysql_query ("select listing from listings where details=critera");
while ($row2 = mysql_fetch_array($sql2)
{
$email_msg .= "Listing Name: " . $row2['listing_name'] . "\n";
}
mail($row['email'],"Weekly Listings",$email_msg);
}Should I just process them in smaller batches? If so, what seems to be a reasonable number of users to loop through at a time?
Thanks for any help!
Philip
pickle | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]