How to send only last mysql data to email after submitting the form by customer?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sandipcd
    New Member
    • Jan 2013
    • 2

    #1

    How to send only last mysql data to email after submitting the form by customer?

    After customer filling the form, the form data will be send to mysql, and an email will sent to me with the last form data that customer submitted. All is working, but only the problem is in the email "last mysql data" is not going as inline text. So, how to do this? I am doing in PHP. In am new in PHP. Please help me.

    Please see the full code here - http://halmiratea.com/to-stackoverfl...l1.php#problem

    Code:
    $body                = 'Print the data';
    mysql_connect("localhost","XXXXXXX","XXXXXXX");
    @mysql_select_db("sandi565_form11");
    $query["SELECT * FROM demo ORDER BY ID DESC LIMIT 1"];
    $result = mysql_query($query);
    
    //while ($row = mysql_fetch_array ($result)) {
    //  $mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; 
      $mail->MsgHTML($body);
      $address = "XXXXXXX@gmail.com";
      $mail->AddAddress($address, "user2");
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    I'm not sure what you're asking here. Your SQL only returns one row.

    Comment

    • sandipcd
      New Member
      • Jan 2013
      • 2

      #3
      If you see the full code an Mysql format, you can know that I want to send data (only the last mysql data which has been entered by last from submitter) to email as inline text . How can I make this thing happen? However, how can I make the SOL returns multiple row?

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Your screenshot doesn't tell me anything, I don't see any SQL.

        If you want to return more than one record, take out the limit clause.

        I still don't understand what you're asking for, your English is unclear and vague.

        Comment

        Working...