I am trying to get the number of days between two dates. The first of those dates is in the database a field called ("LastChanged"), the second of tose dates is today ($Today=date("Y-m-d")).
I am using this code to try and get the difference between the two dates, but for some reason it is erroring out.
$UserID=$_SESSION["SESSION_USERID"];
$Today=date("Y-m-d");
$Sql="SELECT ChangePass, DateDiff('LastChanged','$Today') AS Days FROM tblUsers WHERE UserID ='$UserID'";
$Result=mysql_query($Sql) or die (mysql_error);
$ResultArray=mysql_fetch_array($Result);
if ($ResultArray['ChangePass']=='YES'){
Print 30-$ResultArray['Days'];
}
Any idea what's wrong?
Thanks!😃