0
<?php include("admin/db.php"); 
$recipients = "SELECT * FROM recipients ORDER BY id DESC";
$email_list = $db->query($recipients);
foreach($email_list as $row) {
    echo $row['email'].","; 
}

$to = "?";

?>

Above I have a comma delimitated list of emails which I need to insert into the $to variable. How do I do this?

4

2 回答 2

1
$recipients = "SELECT * FROM recipients ORDER BY id DESC";
while ($row = mysql_fetch_array($recipients))
{
    $adresses[] = $row['email']; 
}

$to = implode(",",$adresses);
于 2012-11-20T20:34:28.117 回答
0
foreach($email_list as $row) {
    echo $row['email'].","; 


  mail($row['mail'], $subject, $body)

}
于 2009-08-23T04:42:28.397 回答