www.webdeveloper.com
Results 1 to 3 of 3

Thread: Sending E-MAILS After fetching Multiple records

  1. #1
    Join Date
    Aug 2013
    Posts
    40

    Sending E-MAILS After fetching Multiple records

    I want to sending a mail after fetching multiple records from the table, the searching is based on date, mean what ever the records entered by user on the current date that need to be mail to the specific person.

    table from which is need to fetch the records is order_details

    below is my current script..

    HTML Code:
    $selectcondition = "SELECT * FROM order_details where DATE='".$date."'"; // From this table i need to fetch all the records date wise.
    
                            $check=mysql_query($selectcondition,$con);
                            $fetch=mysql_fetch_row($check);
                            
                            
                            while($row = mysql_fetch_array($fetch))
                            {
                              //
                            }
    
                                
                            $from="REPORT@abc.com";
                            $to="admin@abc.com";
                            $subject="Customer report of $date";
                                                    
                            $message ="<html>
                                       <body>
                                       <hr>
                                       
                                       <p> <strong><font color ='#69571F'><em>First</em></font></strong> =><font color ='#858685'> {$first}</font></p>
                                       <p> <strong><font color ='#69571F'><em>Last Person</em></font></strong> =><font color ='#858685'> {$last}</font></p>
                                       <p> <strong><font color ='#69571F'><em>Comments </em></font></strong> =><font color ='#858685'> {$comments}</font></p>
                                       <hr>
                                       </body>
                                       </html>";
                                       
                            $header = 'MIME-Version: 1.0' . "\r\n";
                            $header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";            
                            $header .= "From: {$from}\r\n";
                            $header .= "Reply-To: {$to}\r\n";
                            $header .= "Return-path: " . $to;            
                            
                            //mail($to, $subject, $message,"From:".$from, "-f$from");
                            
                            mail( $to,  $subject, $message, $header, "-f{$from}");
                }
    Right now only the customer information are sending with mail, now i want customer orders detail also should be part of body of a mail... ( single mail is required for both the thing customer information & order details)

    Hope i can able to understand you guys my need , Please let me know if something you need to know more on this..

    Thanks In Advance..

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,500
    I would say that you need to have a customer field...
    PHP Code:
    $selectcondition sprintf("SELECT * FROM order_details where DATE='%s' AND customer='%s' AND orderNumber='%s';--",$date,$customerInf,$orderNo); 
    so that you can make your comments customer specific, swap $customerInf for what you need as well as doing same for the orderNumber to identify your customers order.

    Using sprintf to make a formatted string makes reading the code easier.

    You should also prepare the strings, note that the method you are using to connect to the database and run queries will shortly, not too sure when, not be supported. Would suggest that you get to grips with the PDO or mysqli methods.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  3. #3
    Join Date
    Aug 2013
    Posts
    40
    Thanks for your reply , you did not understand my requirement.

    Please read again what i posted above

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles