title: Create mysql trigger to update specific column after update row
body: <p>I want to update the specific column in MySQL after any change occurred in a row.
  I use below query to create trigger but when to change record data, an error happened.</p>
  <p>trigger query:</p>
  <pre><code>DELIMITER $$
  CREATE TRIGGER after_user_update AFTER UPDATE ON group_chat_message
  FOR EACH ROW
  BEGIN 
     UPDATE `group_chat_message` SET 
     `server_modified_at` = CONCAT(SUBSTRING(REPLACE(NOW(), '-', ''),1,8),SUBSTRING(REPLACE(NOW(), ':', ''),12,8))
      WHERE id = NEW.id
      ;
  END;$$
  DELIMITER ;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/VBHWL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VBHWL.png" alt="error when trigger executed." /></a><br />
  <sub>(source: <a href="https://imohammadi.ir/dl/Untitled.png" rel="nofollow noreferrer">imohammadi.ir</a>)</sub></p>