This question already has an answer here:
- MySQL returns only one row 5 answers
Can Anyone help me with this
SELECT userEmail FROM users in mysql gets a email list like
userEmail
a@gmail.com
b@gmail.com
Currently $userEmail gets first email from the list
a@gmail.com
I am trying to get email list from database like
a@gmail.com,b@gmail.com
<?php
$mailselect = "SELECT userEmail FROM users";
$mailselect2 = mysqli_query($mysqli, $mailselect) or die('-31' . mysqli_error());
$recipients = mysqli_fetch_assoc($mailselect2);
$userEmail = $recipients['userEmail'];
$recipientss = array(',', $row['recipients'] );
$to = 's.gurudharsan@gmail.com';
$subject = "E-mail subject";
$message = 'Testing1: ' . $userEmail . "
" .
'Testing2: ' . implode(',', $recipientss);
$headers = 'From: s.gurudharsan@gmail.com' . "
" ;
$headers .= 'Reply-To: s.gurudharsan@gmail.com' . "
";
mail($to, $subject, $message, $headers);
?>
Currently mail() function sends this email Testing1: a@gmail.com Testing1:
implode(',', $recipientss); This code might be a problem. Anyone with some sugestion
Thanks Guys.
</div>