After effective user registration my MySQL db table puts 0000-00-00 00:00:00 into lastlogin_date and lastlogout_date fields automatically. kind of both fields is datetime. During my php code i am checking if user makes its way into towards the site the very 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, appears, empty does not operate in this situation. how to see if the lastlogin_date area is empty or otherwise? if($lastlogin=='0000-00-00 00:00:00')??

0000-00-00 00:00:00 is really a value. If you won't want to put any value, you need to store NULL, which may make a lot more sense. NULL may be the lack of worth.

That being stated, I believe the easiest way would be to choose a boolean rather than your column :

-- (lastlogin_date is NULL) if you change your table structure
SELECT (lastlogin_date = '0000-00-00 00:00:00') as has_logged_in
  FROM users
 WHERE id = ?;

Whenever you fetch your query, you should use $row['has_logged_in'], the industry boolean.