仅在更新相同记录时才通知用户

I know there are answers for this question already. but I was thinking if there is a way to notify users when they updated the same record from MySQL at the same time using only php codes.

I have a table for user logs. I think the first user activity (which is update the record) will be saved in the logs. then use that record to compare the time of the second user and if it is less than a few seconds, it will be notified to redo the update. Does it make sense?

 $sql="SELECT logdate FROM manage WHERE log_id=(SELECT MAX(log_id) FROM manage)";
   $result = mysqli_query($conn, $sql);
   $row = mysqli_fetch_array($result);
   $rows = $row[0];
   echo $rows;
   $sql="select timestampdiff(SECOND,now(),'$rows')";
   $result = mysqli_query($conn, $sql);
   $row = mysqli_fetch_array($result);
   $s = $row[0];
   echo " ".$s." ";   
   if ($s<=1 and $s>=0) {
       echo "redo update";
   } 

Can't comment on the question, but why not just remove capabilities to even insert into database if a recent user has already done an insert?

Steps:

  1. Check if id has been inserted within a few seconds
  2. If yes: not allow insert; if no: allow insert.

More explanation please if this doesn't relate to the question.