title: Want to write a trigger after UPDATE
body: <p>I have writen a trigger which will log every data updation and will log <code>previous_value, new_value, field_name</code> and many more. But the problem is i have <strong>77 fields</strong> in my table. So, it's difficult to write <code>IF ENDIF</code> for each field so i want to know is it possible to write using loop?</p>
  
  <p>Already asked in dba.stackexchange.com but did not get any fruitfull answer yet, link below::</p>
  
  <p><a href="https://dba.stackexchange.com/questions/164635/want-to-write-a-trigger-after-update">Link</a></p>
  
  <p>I have tried so far::</p>
  
  <pre><code>BEGIN
  
  IF(OLD.company_name != NEW.company_name) THEN
   INSERT INTO elm_activity_log (user_id, action_on, action, action_col, action_old_value, action_new_value, action_at, action_on_id) VALUES (NEW.updated_by, "company", "update", "company_name", OLD.company_name, NEW.company_name, CURRENT_TIMESTAMP(), NEW.company_id);
  END IF;
  IF(OLD.company_first_name != NEW.company_first_name) THEN
   INSERT INTO elm_activity_log (user_id, action_on, action, action_col, action_old_value, action_new_value, action_at, action_on_id) VALUES (NEW.updated_by, "company", "update", "company_first_name", OLD.company_first_name, NEW.company_first_name, CURRENT_TIMESTAMP(), NEW.company_id);
  END IF;
  
  END
  </code></pre>
  
  <p>Please help, or any suggestion will be very helpfull.</p>
  
  <p>Thanks in advance.</p>