title: AFTER INSERT Trigger to insert data into a different table after inserting it into initial table
body: <p>Hello and thanks in advance for any help given!</p>
  
  <p>I have created a very simple database for an electronics online shop.</p>
  
  <p>Among the other tables I have a tbl_orders for orders being placed manually (user inserts the product_id, number of units, payment_details_id and so on manually) and I want to make an AFTER INSERT trigger on tbl_orders that would send the order_id (which is tbl_order's PK) to a table called purchase_history.</p>
  
  <p>The table purchase_history also has a purchase_date column. It's PK is purchase_id, with order_id as a FK.</p>
  
  <p>I am unfamiliar with triggers but I've tried all sorts of simple queries inside a trigger with no luck, though the errors I was getting were getting "better" if one could call it that.</p>
  
  <p>The last try I had was this:</p>
  
  <pre><code>  CREATE DEFINER = CURRENT_USER TRIGGER      `onlineshop`.`tbl_orders_AFTER_INSERT` AFTER INSERT ON `tbl_orders` FOR EACH ROW
    BEGIN
  
    INSERT INTO purchase_history (order_id)
    VALUES (NEW.order_id);
  
    INSERT INTO purchase_history ( purchase_date )
  
    VALUES (purchase_date = NOW());
  
  
    END
  </code></pre>
  
  <p>I am using MYSQL Workbench, which is great but also, sometimes, slightly buggy or confusing.</p>