Mysql
 sql >> Database >  >> RDS >> Mysql

php mysql oggi, ieri e data dal database

    $result = mysql_query("select lastLog from `table` WHERE user_id = '".$_SESSION['userID']."'"); 
    while($row = mysql_fetch_array($result))
        {
         $last_login = $row['lastLog '];
        }

if($last_login  == date('d.m.Y'))
echo "its today";

if($last_login  == date('d.m.Y',strtotime("-1 days")))
echo "it was yesterday";

else
echo 'it was '.$last_login;