I have a script that I need some help with. Its a reminder script (posted below). Basically I have a completiondate (which in the database is a varchar...don't know if that makes a difference) that is made up like day, month, year (Ex: 06102012) and I want the script (which is a cron job) to look at todays date and see if it is 2 days before todays date. If it is then I want an email sent. I'm confused on where I'm going wrong. Please help! Thanks.
An example would be:
Todays date is: 06102012
If completiondate = 2 days before todays date
{
send email
}
$todaysdate = date('d/m/Y');
$query = "SELECT completiondate FROM needs WHERE completiondate =($todaysdate, strtotime('-1 days'))";
$result = mysql_query($query);
mail('derekshull@gmail.com', 'Important Stuff', 'Hey there.');
?>