I am trying to send email to All users from Mysql Database. For this I have written below Code, but it is sending email to First record only. What's wrong I am doing. I need to send email to all users.
if ($_POST['do'] == 'mail') {
$result = $db->query("SELECT email FROM members WHERE status='Active'");
$input="This is a text message";
$userdetails = $db->fetch_array($result);
$emails = implode(",", $userdetails);
$message = $input;
$mail = new mail();
$mail->setFrom($settings['email_support'], $input->pc['name']);
$mail->addTo($emails);
$mail->setSubject('subject text!');
$mail->setBodyText($message);
$mail->send();
}