[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

12/10/2008 at 06:15PM PST, ID: 23974892
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

Php and Cronjob with mail

Asked by doRodrigo in PHP and Databases, MySQL Server, PHP Scripting Language

Tags: php

Hi. My difficulty is the following:

I want to put on, a form with the following fields: From, To, Subject, Message, Hour, Day, Month, Year, Sent. These fields should be recorded in an MySql database.

After the data is recorded there should be a Cronjob that activated automatically another php script that would compare the current date, in a select, to the recorded in the database, if it found any records with the same date it should send an email to the designated in the database.

The function date("r", time()) give me something like this:
Wed, 10 Dec 2008 20:00:32 -0600

First: How do I use this to compare with the fields: hour, day, month, year ?

Second: How do I do the comparison after I retrieved the SELECT?

There are two codes the first is the one accessed by the form and the second is the one that should be accessed by the cron.

I'd like for the Cronjob to run every hour, but could make it work, I' using CPANEL, if any of you could help me with this code also it would be apreciated.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
<?php
$con = mysql_connect("localhost","user","password");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("db_email", $con);
mysql_query("INSERT INTO tb_email (name, from, subject, msg, to, hour, day, month, year, enviado) 
VALUES ('$name','$from','$subject', '$msg','$to','$hour', '$day','$month','$year', '0')");
mysql_close($con);
?>
 
<?php
$con = mysql_connect("localhost","user","password");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("db_email", $con);
$result = mysql_query("SELECT * FROM tb_email WHERE hour='$hour' and day='$day' and month='$month' and year='$year'");
$headers = 'From:' . $from . "\r\n" . 'Reply-To:' . $from . "\r\n" . 'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $msg, $headers);
?>
[+][-]12/10/08 07:48 PM, ID: 23145578

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/11/08 03:03 AM, ID: 23147190

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12/11/08 08:39 AM, ID: 23149819

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/11/08 08:40 AM, ID: 23149825

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/11/08 08:40 AM, ID: 23149830

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/11/08 08:43 AM, ID: 23149870

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/11/08 08:58 AM, ID: 23150009

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/11/08 09:02 AM, ID: 23150037

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12/11/08 09:08 AM, ID: 23150096

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/11/08 09:13 AM, ID: 23150144

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]12/11/08 09:25 AM, ID: 23150276

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12/11/08 09:32 AM, ID: 23150345

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP and Databases, MySQL Server, PHP Scripting Language
Tags: php
Sign Up Now!
Solution Provided By: Ray_Paseur
Participating Experts: 2
Solution Grade: A
 
 
[+][-]12/11/08 09:38 AM, ID: 23150416

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/11/08 09:54 AM, ID: 23150561

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-91 - Hierarchy / EE_QW_2_20070628