CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   PHP (http://www.codingforums.com/forumdisplay.php?f=6)
-   -   Sending mail after updating in php (http://www.codingforums.com/showthread.php?t=275188)

mehidy 10-04-2012 09:36 PM

Sending mail after updating in php
 
1 Attachment(s)
Hi Please see below,
PHP Code:

if ( $smpl_typ == "PPS" && $smpl_cmnts == "Approved" ){
require(
"connect.php");
$buyh $_POST['buyh'];
$buyr $_POST['buyr'];
$artstyl_no $_POST['artstyl_no'];
$tbl_orderid $_POST['tbl_orderid'];
$details "SELECT smpl_col, smpl_subno, smpl_senton, cmnts_rcvon, smpl_cmnts, smpl_rmks FROM tbl_smpl WHERE  smpl_tbl_order_id='$tbl_orderid' AND smpl_typ='PPS' AND smpl_cmnts='Approved'";
$details_result mysql_query$details)
        or die ( 
"Couldn't get Products: ".mysql_error() );
while ( 
$det_row mysql_fetch_array $details_result ) )
{
// message
$message " <p>Dear All<br>Please find below the sample comments for your ref of styel $artstyl_no!</p>
  <table>
        <tr>
          <th>Color</th><th>Sub no</th><th>Sub Date</th><th>Comments Date</th><th>Comments</th><th>Remarks</th>
        </tr>
<tr><td> "
.$det_row'smpl_col' ]."</td>
           <td> "
.$det_row'smpl_subno' ]."</td>
          <td> "
.$det_row'smpl_senton' ]."</td>
          <td> "
.$det_row'cmnts_rcvon' ]."</td>
          <td> "
.$det_row'smpl_cmnts' ]."</td>
          <td> "
.$det_row'smpl_rmks' ]."</td></tr>    
   
  </table><p>This is an auto generated mail, no need to reply.</p><p>Thanking you<br>noreplay@yahoo.com<br>C</p>
"
;
$to  'mehidy@yahoo.com' ', '// note the comma
//$to .= 'sultan@yahoo.com';
// subject
$subject "$smpl_typ comments of Buyer:$buyr Style:$artstyl_no";
// To send HTML mail, the Content-type header must be set
$headers  'MIME-Version: 1.0' "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' "\r\n";
// Additional headers
//$headers .= 'To: reza@yahoo.com, liton@yahoo.com' . "\r\n";
$headers .= 'From: C <mehidy@yahoo.com>' "\r\n";
//$headers .= 'Cc: zahir@yahoo.com' . "\r\n";
//$headers .= 'Bcc: mehidy1984@gmail.com' . "\r\n";
// Mail it
mail($to$subject$message$headers);
}


By using above script, after updating. i am getting two mail for two row from my mysql table. but i want to get two row details in one mail. Plz see my requirement as attached.

tangoforce 10-04-2012 09:51 PM

You need to take your mail() call out of the while() loop. THAT is why its sending individual emails.
Also $message should (in the while loop) be $message .= "your message";

Note the . before the =

mehidy 10-05-2012 04:03 AM

Thank.i got the solution.


All times are GMT +1. The time now is 07:21 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.