Jump to content

check date in mysql file and run process if date true.


brosskgm

Recommended Posts

OK, here is what I'm trying to do.

 

I have the following records in mysql. I'm trying to find examples or some routine that will help me find a way that when the date_to_be_notified matches current date that we can get the server to send an email and or text message out.

 

Thanks for your help.

 


include("connect.php");
$username = $_POST['username'];
$date = $_POST['date'];
$buyer_name = $_POST['buyer_name'];
$contract = $_POST['contract'];
$extended_warranty = $_POST['extended_warranty'];
$type_of_contract = $_POST['type_of_contract'];
$date_to_be_notified = $_POST['date_to_be_notified'];
$notify_email = $_POST['notify_email'];
$notify_text = $_POST['notify_text'];
$message = $_POST['message'];

$query = "INSERT INTO contract_tracker (id, username, date, buyer_name, 
contract, extended_warranty, type_of_contract, date_to_be_notified, 
notify_email, notify_text, message)
VALUES ('', '$username', '$date', '$buyer_name', '$contract', 
'$extended_warranty', '$type_of_contract', '$date_to_be_notified', 
'$notify_email', '$notify_text', '$message')";
$results = mysql_query($query);


when the date_to_be_notified matches current date that we can get the server to send an email and or text message out.

 

First you need a script that will check dates in database "SELECT", not INSERT, as thorpe said.

second to get server send mail/msg automatically you will need to schedule cron.

 

$date= "date()?" // depends on how u store date in db
$query=mysql_query("SELECT * FROM `contact_tracker` WHERE `date_to_be_norified` = '$date'");

 

actually if u have date stored dd/mm/yyyy or whatever else it will help.

 

OK, thanks.

 

This gives me something to start on.

 

I might have posted this in the wrong area. I might need a cgi or perl script to call from a cron to do this also.

 

when the date_to_be_notified matches current date that we can get the server to send an email and or text message out.

 

First you need a script that will check dates in database "SELECT", not INSERT, as thorpe said.

second to get server send mail/msg automatically you will need to schedule cron.

 

$date= "date()?" // depends on how u store date in db
$query=mysql_query("SELECT * FROM `contact_tracker` WHERE `date_to_be_norified` = '$date'");

 

actually if u have date stored dd/mm/yyyy or whatever else it will help.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.