I'm new to the forum and was wondering if anyone could help me!
Basically, I'm trying to create a script that will send an email to a group of recipients that are created elsewhere, plced in mysql database and then recalled and added as a variable to which the email is sent.
The problem I have is that I'm unsure how to get the email addresses from the database.
I've put a bit of code below. The idea is that the email addresses are taken from the db. This doesn't work. the email will go to the example address. How can I assign the email addresses from the db to individual variables?
Expand|Select|Wrap|Line Numbers
- $query = "SELECT * FROM townfield";
- $result = mysql_query($query) or die(mysql_error());
- while($row = mysql_fetch_array($result)){
- echo $row['email'];
- echo "<br />";}
- if($fao == "1") {
- $attention = "All Staff";
- $recipients = $row['email'] . "," . "example@fixedaddress.com";}