I have searched this topic and came up with some answers but they don't seem to work. I am a beginner at PHP and I need to create a variable that tells if a clients original order date is older than 52 days from the current date. Here is what I have that is not working
$orderdate = $row['OrderDate'];
if(strtotime('$orderdate')<= strtotime('-52 days')){
$pastdue ='This Order is older than 52 Days';
}else{
$pastdue ='This order is newer than 52 Days';
}
The order date comes from a MySQL database and is formatted like '2014-12-11 08:45:56'. The problem is that every time I echo the $pastdue variable later in the script it uses the first variable 'This Order is older than 52 days'. It will not recognize if the order is between 0 and 52 days. Any ideas of what I am doing wrong? Or a better way of doing it? The field in the MySQL database is a datetime field.