title: How to program a MySQL trigger to insert row into another table?
body: <p>I'm looking to create a MySQL trigger on a table. Essentially, I'm creating an activity stream and need to log actions by users. When a user makes a comment, I want a database trigger on that table to fire and:</p>
  
  <ol>
  <li>Grab the ID of the last inserted row (the id of the comment row).</li>
  <li>perform an INSERT into an activities table, using data from the last inserted row.</li>
  </ol>
  
  <p>I'll essentially replicate this trigger for deleting comments.</p>
  
  <p>Questions I had:</p>
  
  <ol>
  <li>Is LAST_INSERT_ID() the best way to grab the id?</li>
  <li>How do I properly store the data from the last inserted comment row for use in my "INSERT into activities" statement?</li>
  <li>Should I be using a combination of stored procedures as well as the trigger? </li>
  <li>What would the basic structure of the trigger look like?</li>
  </ol>
  
  <p>Thanks! It's been a few years since I've touched anything to do with DB triggers, procedures and functions.</p>