I'm trying to compare the current date with a date field returned by a MySQL query called "expiry_date". This field is a date field formatted as YYYY-MM-DD I'm using If Else, to initialize a variable with the result as follows:
$today = $expiry_date = date("d-M-Y", strtotime("now"));
if ($row['expiry_date'] > $today)
{
$msg="Not Expired";
}
else
{
$msg="Expired";
}
This doesn't appear to work and I would appreciate any suggestions on how to fix this.
$rowsounds like something of a database: If you can filter it on the database side, filter it on the database side (in the query). Correctly used, mysql beats any php application for matters of sorting, joining, filtering.