Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-04-2012, 09:36 PM   PM User | #1
mehidy
New Coder

 
Join Date: Jan 2011
Location: Bangladesh
Posts: 73
Thanks: 4
Thanked 0 Times in 0 Posts
mehidy is an unknown quantity at this point
Sending mail after updating in php

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.
Attached Thumbnails
Click image for larger version

Name:	mail.gif
Views:	48
Size:	42.9 KB
ID:	11602  
mehidy is offline   Reply With Quote
Old 10-04-2012, 09:51 PM   PM User | #2
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,516
Thanks: 45
Thanked 440 Times in 429 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
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 =
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Users who have thanked tangoforce for this post:
mehidy (10-05-2012)
Old 10-05-2012, 04:03 AM   PM User | #3
mehidy
New Coder

 
Join Date: Jan 2011
Location: Bangladesh
Posts: 73
Thanks: 4
Thanked 0 Times in 0 Posts
mehidy is an unknown quantity at this point
Thank.i got the solution.
mehidy is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:52 AM.


Advertisement
Log in to turn off these ads.