After successful user registration my MySQL db table puts 0000-00-00 00:00:00 into lastlogin_date and lastlogout_date fields by default. type of both fields is datetime. In my php code i'm checking if user enters to the site for the first time
$lastlogin = $db->query("SELECT `lastlogin_date` FROM `users` WHERE `id`='$_SESSION[id]'");
$row = $lastlogin->fetch_array(MYSQLI_BOTH);
$lastlogin=$row['lastlogin_date'];
if(empty($lastlogin))
{ do something}
But, seems, empty doesnt work in this case. how to check if the lastlogin_date field is empty or not? if($lastlogin=='0000-00-00 00:00:00')??
if ($lastlogin == '0000-00-00 00:00:00')is not a bad option