Forum Moderators: coopster
--------------
$expiry = $row["end_date"];
$today = strtotime("now");
$date_today = date('m/d/y',$today);
if ($expiry > $date_today) {
$new_status == "Expire";
} else {
$new_status == $row["status"];
}
--------------
What I want to happen is to compare the $expiry with the $date_today. If the $expiry is after the date_today (meaning it has passed already), then the $new_status would have "Expire" as its value. Otherwise, it will just get the value from the database and display it as it is.
The $row["end_date"] that comes from the database is of varchar field.
Thanks.
So use strtotime on todays date and on the date you pull from the database and then see which is greater.
$expiry = strtotime($row["end_date"]);
$today = strtotime("now");
//$date_today = date('m/d/y',$today); - no longer neededif ($expiry > $today) {
$new_status == "Expire";
} else {
$new_status == $row["status"];
}
Think thats right, but surely it should be if expiry is less than todays date? If it is greater then it is in the future?!