Monday, 9 September 2013

php dates and if statements

php dates and if statements

So, i'm working on grabbing a date of payment from a database, then add a
year onto it as its expiry date. I want the user to know whether they are
active or inactive when they log in.
However, everytime I login with someone who's payment hasn't expired yet,
i get the you are an inactive member message. Can someone have a look and
see where I am going wrong?
$paymentdate = strtotime($row[1]);
$paymentexpire = strtotime("+1 year", $paymentdate);
$currentdate = date('Y-m-d');
if($paymentdate != null && $paymentdate <= $currentdate && $currentdate <
$paymentexpire){
$msg = $p->addContent("You are an active member<br>");
}
else{
$msg = $p->addContent("You are an inactive member<br>");
}

No comments:

Post a Comment