I want to send multiple emails to different email address and update status in my database

316
March 21, 2017, at 3:21 PM
if(isset($_POST['upallnew'])){
   $order_id=($_POST['order_id']);
   for ($i=0;$i<count($order_id);$i++){
      $order_id=$_POST['order_id'];
      $first=$_POST['firstname'];
      $mid=$_POST['middlename'];
      $last=$_POST['lastname'];
      $add=$_POST['add'];
      $em=$_POST['email'];
      $stat=$_POST['statusnew'];
      if($stat=="Delivering"){
         $body='<p>Dear '.$first[$i].','.$mid[$i].' '.$last[$i].'</p>';
         $body.='<p>Our delivery truck is on his way to deliver your order ID#'.$order_id[$i].' to your address '.$add[$i].'.<br> Please prepare cash for payment.</p>';
         $body.='<p>Best regards,</br><b>Museeker Team</b></p>';

I need to send this to a multiple email address and after that .

error_reporting(E_ALL);
require("PHPMailer_5.2.4/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->SMTPDebug  = 2; 
$mail->From = "sher.plac@gmail.com";
$mail->FromName ="MUSEEKER";
$mail->Host = "smtp.gmail.com"; // specif smtp server
$mail->SMTPSecure= "ssl"; // Used instead of TLS when only POP mail is    selected
$mail->Port = 465; // Used instead of 587 when only POP mail is selected
$mail->SMTPAuth = true;
$mail->Username = "sher.plac@gmail.com"; // SMTP username
$mail->Password = "secret"; // SMTP password
$mail->AddAddress($em[$i], $first[$i]); //replace myname and mypassword to yours
$mail->AddReplyTo("sher.plac@gmail.com", "Sherwin");
$mail->WordWrap = 50; // set word wrap//
$mail->AddAttachment("c:\\temp\\js-bak.sql"); // add attachments//
$mail->AddAttachment("c:/temp/11-10-00.zip");
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = 'Order';
$mail->Body = $body;

Once the email successfully sent i want to update the status of the email that successfully sent sorry for my bad english. Thanks in advance :) i`m a beginner.

if($mail->Send()) {
   echo "Send mail successfully";
   $up_stat=mysql_query("update `order` SET Status='$stat' where ID='".$order_id[$i]."'");
   if($up_stat){
      echo"<script>alert('Update Success')</script>";
      echo"<script>window.open('orders.php','_self')</script>";
   }
}
else {
   echo "Send mail fail";
   echo $order_id[$i];
   exit();
   }
}
}
}
Rent Charter Buses Company
READ ALSO
Selected values from the database doesn&#39;t show in the form

Selected values from the database doesn't show in the form

I'm new to PHP OOP, and I have a problem hereI am trying to select users from my database and display it in the form, I don't get any errors, but the users still are not displayed

258
Insert data into Sqllite has some error by using jQuery

Insert data into Sqllite has some error by using jQuery

I want to complete a chat app , i reference http://wwwandroidhive

344
Prioritized MySQL Search engine

Prioritized MySQL Search engine

Can anyone suggest me an algorythm for building a query which searches for keywrods inside mysql column by giving words certain priorityFor example I have 3 words "Chevrolet Kalos 1

248
MySQL error: Could not execute MySQL-statement: Incorrect datetime value?

MySQL error: Could not execute MySQL-statement: Incorrect datetime value?

In one of my table, there are multiple column of type TIMESTAMPAnd I have to insert the future TIMESTAMP in these columns

501