Hi all,
I am trying to a write statement that I can use to expire dates within my db. I want it to work, that if the two fields from the db, $expdate & $exptime are less than the current date & time ($nowdate & $nowtime), then it changes a status field in the db to EXPIRED, else, leave it as it is (ACTIVE)
I understand most of it, but to just get it to print ACTIVE or EXPIRED for my tests, I have run into problems.
To do my tests, I have used the following script:
$nowdate=date("D M j, Y");
$nowtime=date("H:i");
$expdate="Wed July 9, 2003";
$exptime="15:55";
if ($exptime <$nowtime)
{
echo " Time is EXPIRED";
}
else
{
echo "Time is ACTIVE";
}
echo "<br>";
if ($expdate <$nowdate)
{
echo " Date is EXPIRED";
}
else
{
echo "Date is ACTIVE";
}
That works fine - this statement, with my variables prints:
Time is EXPIRED
Date is ACTIVE
Perfect. But here's the thing I cannot do. I want to join them together so that if $expdate AND $exptime are less than $nowdate AND $nowtime, the result is echoed as EXPIRED, else the result is ACTIVE.
How do I do this? Any help appreciated.
Jonathen