I’m trying to calculate the difference between 2 dates, the current date and the date my members subscribed on the site. If the difference is more than 30 days, I turn off their subscription. I just can’t get it to work.
$strFind="SELECT DATEDIFF(date, curdate()) AS total FROM `monthlydues` WHERE `memid`=\"$curmemid\" ORDER BY `id` DESC LIMIT 1";
$result=mysql_query($strFind) or die(mysql_error());
$row=mysql_fetch_array($result);
$gtime=$row['total'];
if($gtime>30){
$strsql="UPDATE monthlydues SET `active`='N' WHERE `memid`=\"$curmemid\"";
mysql_query($strsql,$connect) or die(mysql_error());
$chkrow5=mysql_affected_rows($connect);
}
Why not one statement?
So this?