runnerjp Posted June 5, 2008 Share Posted June 5, 2008 how could i send a prive message to every 1 in my db? so $reciever = everyone Quote Link to comment https://forums.phpfreaks.com/topic/108906-sending-message-to-every-1-in-my-db/ Share on other sites More sharing options...
prcollin Posted June 5, 2008 Share Posted June 5, 2008 how could i send a prive message to every 1 in my db? so $reciever = everyone //Select the "email" column from the table or whatever you named it $query = "SELECT email from Table"; //Then loop through all emails while there are emails to loop through $result = mysql_query($query) or die("Error in query: $query. ".mysql_error()); while ($row = mysql_fetch_assoc($result)) { // create the email function $email = $row['email']; echo "$email<br />"; $headers .= "Bcc: $email\n"; } or somethign to that effect Quote Link to comment https://forums.phpfreaks.com/topic/108906-sending-message-to-every-1-in-my-db/#findComment-558703 Share on other sites More sharing options...
.josh Posted June 5, 2008 Share Posted June 5, 2008 ^ depends on how many emails you are sending you might need to break it down into bite-sized chunks so your script don't timeout. Quote Link to comment https://forums.phpfreaks.com/topic/108906-sending-message-to-every-1-in-my-db/#findComment-558707 Share on other sites More sharing options...
prcollin Posted June 5, 2008 Share Posted June 5, 2008 maybe do this instead of what i said for the last part in my first response // parts of the email you might want to add $to = $row[$row_email]; $subject "WHATEVER YOU WANT"; $header = "From: $from (Need to define this variable)"; $body = "what you want to say\n"; //mail function to send it off mail($to, $subject, $body, $header); Quote Link to comment https://forums.phpfreaks.com/topic/108906-sending-message-to-every-1-in-my-db/#findComment-558708 Share on other sites More sharing options...
prcollin Posted June 5, 2008 Share Posted June 5, 2008 ^ depends on how many emails you are sending you might need to break it down into bite-sized chunks so your script don't timeout. ive never had that problem so i dont know how to break it down care to elaborate please? Quote Link to comment https://forums.phpfreaks.com/topic/108906-sending-message-to-every-1-in-my-db/#findComment-558710 Share on other sites More sharing options...
.josh Posted June 5, 2008 Share Posted June 5, 2008 well if you are only sending a couple of emails then your script will process it in time but if you have like hundreds or thousands of emails, you're script is going to timeout because it will take too long to send all those emails. So you would break the email list down into smaller chunks and send them 1 chunk at a time. Quote Link to comment https://forums.phpfreaks.com/topic/108906-sending-message-to-every-1-in-my-db/#findComment-558715 Share on other sites More sharing options...
prcollin Posted June 5, 2008 Share Posted June 5, 2008 well if you are only sending a couple of emails then your script will process it in time but if you have like hundreds or thousands of emails, you're script is going to timeout because it will take too long to send all those emails. So you would break the email list down into smaller chunks and send them 1 chunk at a time. oh ok i get what you mean do it for like 5 rows at a time and repeat Quote Link to comment https://forums.phpfreaks.com/topic/108906-sending-message-to-every-1-in-my-db/#findComment-558720 Share on other sites More sharing options...
.josh Posted June 5, 2008 Share Posted June 5, 2008 yeah...well, you can do more than that. Like 20-50. Guess it really depends on your server. Quote Link to comment https://forums.phpfreaks.com/topic/108906-sending-message-to-every-1-in-my-db/#findComment-558729 Share on other sites More sharing options...
prcollin Posted June 5, 2008 Share Posted June 5, 2008 yeah...well, you can do more than that. Like 20-50. Guess it really depends on your server. how would i append my code to allow that i cant find it on google Quote Link to comment https://forums.phpfreaks.com/topic/108906-sending-message-to-every-1-in-my-db/#findComment-558796 Share on other sites More sharing options...
runnerjp Posted June 6, 2008 Author Share Posted June 6, 2008 i looked on google to break it down but also can find it any where... thanks for ino tho thats very simple indeed and didnt even think of that lol Quote Link to comment https://forums.phpfreaks.com/topic/108906-sending-message-to-every-1-in-my-db/#findComment-558964 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.