473,378 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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

3
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("SELECT title, lastname, email FROM table WHERE DATE_SUB(CURDATE(),INTERVAL 7 DAY) = DATE(FROM_UNIXTIME(date))");

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

while($row = mysql_fetch_array($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,$message,"From:email@example.com\r\n");
}

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

mysql_close($link);

?>

I don't think it's the SQL query as running it inside MySQL returns the correct data.
Aug 31 '06 #1
2 1671
Robbo
3
I should have mentioned, running ->php -a -e -l -f file.php gives this error:

Errors parsing \path\file.php
Aug 31 '06 #2
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
Sep 4 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Wayno | last post by:
Hoping someone can help me out with this problem. First problem, is I am unable to view my php error log. In my php.ini I have my log in /var/www/logs/php_error_log. However, it has remained empty....
5
by: php newbie | last post by:
Hello, I am learning php. I have created a simple Web page with a form. After receing the POST request, I do some error checking. In case of errors, I would like to re-post the page, but with...
1
by: Dave Calhoun | last post by:
I think I have it narrowed down. If I do "sendmail -t dave@myhost.com" it works great. No errors in the log. If I do "mail -s "test" dave@myhost.com" it also works great. No errors in the log. So I...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
9
by: deepaks85 | last post by:
Dear Sir, I have created a simple request form which will be mailed to me. Now I want to attach files and send it through that request form. For this I am using the following script: ...
3
by: Dudely | last post by:
I'm trying to debug someone else's third party code that I'm trying to install on my site. It works for him on his site, but not for me on "my" site. I've traced the problem to the mail() call....
4
by: Rajendran | last post by:
I want to send mail through PHP using the MS Exchange server. My php.ini file looks like this (for the MAIL functions) ------- ; For Win32 only. SMTP = exchgserver.test.com smtp_port = 25 ;...
2
by: Ruud | last post by:
Just before leaving for a holiday my collegue modified this script. Now it won't send any body text (The data filled in on the form) and in an error condition it won't send any attachments either....
3
by: Alan M Dunsmuir | last post by:
I'm using Kate in Linux (and UltraEdit when I have to drop back into Windows) for writing my PHP code. As a independent, self-employed developer, I cannot afford a commercial IDE for PHP such as is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.