title: MySQL Trigger and Error Code 1362
body: <p>So I have the following query for a trigger:</p>
  
  <pre><code>DELIMITER $$
  CREATE TRIGGER user_log_update BEFORE UPDATE on user_log
  FOR EACH ROW
  BEGIN
  insert into user_log
  (id, user_id, name, username, password, email, user_type_id, created)
  VALUES(OLD.id, OLD.user_id, OLD.name, OLD.username, OLD.password, OLD.email, OLD.user_type_id, OLD.created);
  IF (OLD.id = 1) THEN
  SET OLD.id = OLD.id +1;
  END IF;
  SELECT * FROM user_log;
  END$$
  DELIMITER ;
  </code></pre>
  
  <p>When I try to execute this part of the script, I get <code>Error Code: 1362. Updating of OLD row is not allowed in trigger</code></p>
  
  <p>I don't know why I got this error and I don't see anything wrong in the syntax. </p>
  
  <p>Does anyone know how to fix it?</p>