php - Check If User Subscription Is In Date - Not Working -


i have code in login script check if users subscription in date:

// current date $now = date("y-m-d");     if ($user_id['enddate'] < $now) {       ?>       <p>your licence out of date</p>       <?php       } else       {       ?>       <p>your licence in date</p>       <?php       } 

the value storing expiry date 'enddate'.

it goes straight out of date message, whether user has subscription in date or not. can't head around it.

the mysql field enddate type 'date', , generated registration script:

$enddate = date("y-m-d", strtotime("+ 365 day")); 

any ideas? know i'm working in depreciated mysql, need project.

cheers

you need convert time, date string...

$now = strtotime(date("y-m-d")); if (strtotime($user_id['enddate']) < $now) {   ?>   <p>your licence out of date</p>   <?php   } else   {   ?>   <p>your licence in date</p>   <?php   } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -