title: Mysql said: #1422 - Explicit or implicit commit is not allowed in stored function or trigger
body: <p>In the code below I'm trying to create a trigger which inserts 'incidentimg' table id along with an image path if the user of the web application did not upload a image with the form belonging to 'incidentreport' table, however, I'm only getting the error "<em>MySQL said: #1422 - Explicit or implicit commit is not allowed in stored function or trigger</em>"</p>
  
  <pre><code>DROP TRIGGER IF EXISTS `insertImage`;
  CREATE TRIGGER `insertImage` AFTER INSERT ON `incidentreport` 
  FOR EACH ROW 
  BEGIN 
      IF(SELECT incidentimg.incidentImgId FROM incidentimg 
         LEFT JOIN incidentreport ON incidentimg.imgs_incidentReportId = incidentreport.incidentReportId 
         WHERE incidentimg.incidentImgId IS NULL) 
         THEN INSERT INTO incidentimg(incidentImgId, imgUrl)values(NEW.incidentReportId, 'images/no-image.png'); 
      END IF; 
  END
  ;
  </code></pre>
  
  <p>Here are the tables being used
  <img src="https://i.stack.imgur.com/Xc0ci.png" alt="enter image description here"></p>
  
  <p>Can someone assist me on how to correct this problem</p>