Mail() Problem - 'Errors parsing file.php'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Robbo
    New Member
    • Aug 2006
    • 3

    Mail() Problem - 'Errors parsing file.php'

    I have set up a php script to send a notification email to customers one week after initially placing their order. Here's the code:

    <?
    # First, open a database connection
    #
    mysql_connect(' 127.0.0.1:3306' , 'user', 'pass') or
    die('Could not connect: ' . mysql_error());
    mysql_select_db ('database');

    #
    # Query the database for orders placed seven days prior to the current date
    #

    $result = mysql_query("SE LECT title, lastname, email FROM table WHERE DATE_SUB(CURDAT E(),INTERVAL 7 DAY) = DATE(FROM_UNIXT IME(date))");

    #
    # Now use PHP's built-in 'mail()' function to send the message
    #

    while($row = mysql_fetch_arr ay($result)) {

    $subject = "Order in Progress";

    $title = $row['title'];

    $lastname = $row['lastname'];

    $message = "Dear $title $lastname,\r\n\ r\n We are currently processing your order.\r\n\r\n Our despatch team will contact you (if not already) using the telephone number supplied with your initial order when your products are ready for despatch.\r\n\r \n Thank you again for your order, should you have any queries please call our sales team\r\n\r\n Thank you.\r\n";

    mail($row['email'],$subject,$mess age,"From:email @example.com\r\ n");
    }

    #
    # Finally, close the database connection as it is no longer required
    #

    mysql_close($li nk);

    ?>

    I don't think it's the SQL query as running it inside MySQL returns the correct data.
  • Robbo
    New Member
    • Aug 2006
    • 3

    #2
    I should have mentioned, running ->php -a -e -l -f file.php gives this error:

    Errors parsing \path\file.php

    Comment

    • rkagrawal
      New Member
      • Aug 2006
      • 13

      #3
      Originally posted by Robbo
      I should have mentioned, running ->php -a -e -l -f file.php gives this error:

      Errors parsing \path\file.php
      Does the code you quoted belongs to file.php ?
      If not , let me have the file.php because i cant see any error in the above code.


      Rahul Agrawal
      Developer
      Web2003 Corporation
      www.web2003corp .com

      Comment

      Working...