How to save date of user login into another table using php and Mysql

You can use this logic to achieve your functionality

<?php 
  $todayDate = date('Y-m-d');
  //modify this query based on your framework
  $userTodayResult = "select * from user_login where user_id = ".$userId." and login_date = "$todayDate"";


if(empty($userTodayResult)){
  //insert your record with today date 
}
?>


Leave a Comment