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);


Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.