Mysql
 sql >> Datenbank >  >> RDS >> Mysql

php mysql heute, gestern und Datum aus der Datenbank

    $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;