I want to select records from my table which have a date which is older than 200 days.
The following code calculates that date and displays it on the page as '2011-08-10':
$todayDate = date("Y-m-d");// current date
echo "Today: ".$todayDate."<br>";
//Subtract 200 days from today
$rptdate = strtotime(date("Y-m-d", strtotime($todayDate)) . " -200 day");
echo "200 days ago:";
print $rptdate;
When I put hard-code '2011-08-10' as a criteria for my query, it works fine. When I put $rptdate in it only shows me records which have no date at all.
What am I missing?