更新while循环php中的行

时间:2012-11-29 05:52:14

标签: php sql email while-loop

我有一个正在运行的邮件脚本,有时候发送时间因为我们的互联网连接不稳定而超时。我被建议在邮件发送后将邮件标记为邮件。我已经尝试过这个脚本,但到目前为止它只更新了它发送的第一封电子邮件,而不是其余的。

if(isset($row_get_sender['setfrom_email'])) {
    do {
        $mail->AddAddress($row_get_recipient['email']); 
        $mail->Send();
        $update_recipient;
        $mail->ClearAddresses();
    } while($row_get_recipient = mysql_fetch_assoc($get_recipient));
}

和我的疑问:

mysql_select_db($database_mail, $mail);
$query_get_recipient = "SELECT * FROM `to` WHERE `mailSent` = '0'";
$get_recipient = mysql_query($query_get_recipient, $mail) or die(mysql_error());
$row_get_recipient = mysql_fetch_assoc($get_recipient);
$totalRows_get_recipient = mysql_num_rows($get_recipient);

$query_update_recipient = "UPDATE `to` SET `mailSent` = '1' WHERE `email` = '$row_get_recipient[email]'";
$update_recipient=mysql_query($query_update_recipient,$mail) or die (mysql_error());

0 个答案:

没有答案