suttercain Posted August 25, 2007 Share Posted August 25, 2007 Hi everyone, I am making a simple mail form that will SELECT email address from a MySQL table based on the userid of the person sending the email. if (isset($_POST['submit'])) { require('../database.php'); $result = mysql_query("SELECT * FROM emailList WHERE merchantId = '".$_SESSION['id']."'") or die(mysql_error()); What would be the most efficient way of storing the email addresses from MySQL (may be 1 or may be 100) and then sending them in BCC to all the people gathered from the MySQL table? Thanks SC Link to comment https://forums.phpfreaks.com/topic/66698-solved-best-way-to-grab-email-addresses-from-mysql-and-send-an-email/ Share on other sites More sharing options...
suttercain Posted August 25, 2007 Author Share Posted August 25, 2007 PS. I know how to send the email, I just need to know how to make the addresses into a single variable. Link to comment https://forums.phpfreaks.com/topic/66698-solved-best-way-to-grab-email-addresses-from-mysql-and-send-an-email/#findComment-334142 Share on other sites More sharing options...
suttercain Posted August 25, 2007 Author Share Posted August 25, 2007 Alright, I tried: [code] <?php if (isset($_POST['submit'])) { require('../database.php'); $result = mysql_query("SELECT emailAlerts FROM emailList WHERE merchantId = '".$_SESSION['id']."'") or die(mysql_error()); $row = mysql_fetch_array($result); $bcc = implode(", ", $row); echo $bcc; } ?> But it echoes the same email address twice instead of each separate address. Any suggestions? Thanks[/code] Link to comment https://forums.phpfreaks.com/topic/66698-solved-best-way-to-grab-email-addresses-from-mysql-and-send-an-email/#findComment-334151 Share on other sites More sharing options...
j5uh Posted March 28, 2008 Share Posted March 28, 2008 this is something I'm looking for. any solutions out there? Link to comment https://forums.phpfreaks.com/topic/66698-solved-best-way-to-grab-email-addresses-from-mysql-and-send-an-email/#findComment-503418 Share on other sites More sharing options...
discomatt Posted March 28, 2008 Share Posted March 28, 2008 Do you expect multiple rows to be returned in your SELECT query? Link to comment https://forums.phpfreaks.com/topic/66698-solved-best-way-to-grab-email-addresses-from-mysql-and-send-an-email/#findComment-503450 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.