Results 1 to 3 of 3

Thread: Sending E-MAILS After fetching Multiple records

  1. #1
    Join Date
    Aug 2013

    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.
                            while($row = mysql_fetch_array($fetch))
                            $subject="Customer report of $date";
                            $message ="<html>
                                       <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>
                            $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
    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.
    --> JavaScript Frameworks like JQuery, Angular, Node <--
    ... and please remember to wrap code with forum BBCode tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

  3. #3
    Join Date
    Aug 2013
    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