Comparing todays date to a stored date in php
I am trying to compare two dates (one stored in the db) and today's date
using PHP and outputing a "print" statement based on the result of the
comparison. My expiration date is stored as "datetime" in the db. It is
called through a query and assigned to the variable $expire. The code I
have for the comparison is below, but it always returns false, regardless
of the date.
<? $todays_date = date("m-d-Y"); $today = strtotime($todays_date);
$expired = strtotime($expire); if ($today > $expired) {print "<a
target='_blank'
href='/pdfwriter/generate_certificate.php?member=".$memberID."'>Print
Membership Certificate</a>";} else {print "<a
href='registration/registration.aspx?registerType=1'>Membership
Expired - Renew Today</a>";} ?>
No comments:
Post a Comment