この問題を解決するのを手伝ってもらえますか? 一度集めたメールアドレスを全て返却したい。これがコードです。コメントが追加されます。
function send_notification($ML_today) {
// Getting expired contents from the database through a function
$ML_send_to = check_expired($ML_today);
if(count($ML_send_to) != 0){
foreach ($ML_send_to as $ML_user_id) {
$ML_query_email = mysql_query("SELECT `email` FROM `users` WHERE `userID` = '$ML_user_id'");
$ML_row_3 = mysql_fetch_array($ML_query_email);
$ML_email = $ML_row_3[0];
$ML_to = $ML_email;
$ML_subject = 'Library notification';
$ML_message = 'You have an expired library book to be returned. Please check your reservations.';
$ML_headers = 'From: libray@example.com' . "\r\n" .
'Reply-To: libraryr@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($ML_to, $ML_subject, $ML_message, $ML_headers);
// Here I want to collect all the email addresss I sent emails and return once
$ML_sent_all = // Stucked here
}
// Rerturning Emails
return 'Message sent to: ' . $ML_sent_all;
}
}