Hello, I'm trying to take a list of email addresses that I'm pulling out of a database and format them in such a way that I can use the mail function to send a message to them. So, for example, if I retrieve x@y.com and z@y.com from the db, then I want to store them in this fashion "x@y.com, z@y.com". How do I do this? Here's my code so far:
$result = mysql_query("SELECT peopleID FROM ex_committee_people WHERE committeeID='$committeeID'");
while ($row = mysql_fetch_array($result))
{
$peopleID = $row["peopleID"];
$result2 = mysql_query("SELECT email FROM ex_people WHERE peopleID='$peopleID'");
while ($row = mysql_fetch_array($result2))
{
$email = $row["email"];
}
}
Basically, that final $email variable will hold each address as it goes through the loop, I want to collect those email address and store them with commas in between in a single variable. Any help is much appreciated!
Thanks!
Tommy