title: Mysql trigger after inserting into 2 tables
body: <p>I have some problem in creating trigger that executes after insertion is completed in 2 tables.</p>
  
  <pre><code>"insert into table_products values (NULL, '$product_name', '$product_description', '$image_path', '$brand_id', 1)";
  
  "insert into table_product_categories values ($product_id, '$subcatty_id')";
  </code></pre>
  
  <p>Once these 2 queries are executed i want to hit a trigger:</p>
  
  <pre><code>UPDATE table_product_count SET count = count + 1 WHERE brand_id = NEW.brand_id &amp;&amp; category_id = NEW.category_id;
  </code></pre>
  
  <p>Problem is that NEW.brand_id wont be available at this moment.</p>
  
  <p>How to solve this?</p>