title: trigger update another table's counter
body: <p>Can't seem to get this trigger to work... Some help would be appreciated.</p>
  
  <pre><code>DROP TRIGGER IF EXISTS trigger_votes;
  
  CREATE TRIGGER trigger_votes AFTER INSERT ON votes
  UPDATE collections
  SET IF(vote = 1, loves, hates) = IF(vote = 1, loves, hates) + 1
  WHERE collections.id = NEW.collection_id;
  </code></pre>
  
  <p>When a new 'vote' is recorded in table votes, I want to increment the column 'loves' OR 'hates' in the table collections which holds a count. The votes table has a column called collection_id which corresponds to a record in the collections table.</p>