php - How to know if the date is in past? -
i have field called "date2" in table users. it's this: "2014-06-01" need check if date in past. tried this, not working
$result = mysql_query("select date2 users"); $json = array(); while($r=mysql_fetch_array($result,mysql_assoc)){ $date=$r; if (time() > strtotime($date)) { $result = mysql_query("update users set seat1='p',seat2='p',seat3='p',seat4='p',request_pass='p',payed=0 date2='$r'"); } }
if want update users have date2
value in past (e.g. expired) can in 1 query:
update users set seat1='p',seat2='p',seat3='p',seat4='p',request_pass='p',payed=0 date2 < curdate()
Comments
Post a Comment