title: Error when Updating a Table with Trigger
body: <p>I have a trigger setup that every time a new table is created, it reads the ID (which is in <code>varchar</code>) and converts it to <code>integer</code> and stores it in another column.</p>
  
  <p>However when I run it I encounter the following error:</p>
  
  <p><code>Can't update table 'products' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.</code></p>
  
  <p>This is my trigger:</p>
  
  <pre><code>CREATE TRIGGER `var_to_int` AFTER INSERT ON `products`
  FOR EACH ROW UPDATE `products` 
  SET `int_id`= CAST(`var_id` AS INT)
  WHERE `int_id` IS NULL OR `int_id` = ''
  </code></pre>
  
  <p>How do I prevent this?</p>
  
  <hr>
  
  <p>This error is thrown by the PHP script creating a new item in the table.</p>