tektipsismyfavorite
Technical User
I'm using PHPMailer to send out emails based on what comes up in the Query. Using a do { } while ( ); seems to only send out the first record.
I'm using:
Currently I'm using something to the effect of:
I also tried a for loop, but that didn't work at all. Basically I just want to loop through each row in the query result and send a PHPMailer.
I'm using:
Code:
mysql_select_db($database, $connection);
$query = "SELECT * FROM events WHERE date BETWEEN '2006-06-26 00:00:00' AND '2006-07-26 23:59:59'";
$sql = mysql_query($query, $connection) or die(mysql_error());
$row_query = mysql_fetch_assoc($sql);
Currently I'm using something to the effect of:
Code:
do {
$mail = new PHPMailer();
$mail->From = "me@mydomain.com";
$mail->AddAddress($row_query['email']);
$mail->Subject = "Message";
$mail->Body = $row_query['content'];
if(!$mail->Send()) {
$sendError = $mail->ErrorInfo;
}
} while ($row_query = mysql_fetch_assoc($sql));
I also tried a for loop, but that didn't work at all. Basically I just want to loop through each row in the query result and send a PHPMailer.