title: How to change one column or another depending on value?
body: <p>I am working on a Tinder clone for school using node.js and mysql and have a system that involves liking and disliking people. I unfortunately based a lot of my database on a user's chosen username and am now coming up against the problem of when a user wants to change their username I need to change all instances of it in my database. (I know I should've used user ID's instead but at this point it's too late to change as the project is almost finished and it's only for learning purposes for school.) I'm having a problem changing the data in one column or another based on where the username exists. Example of my database table called likes:</p>
  
  <pre><code>Liker    | Liked
  -------------------
  jennifer | matt
  jennifer | colin
  jennifer | justin
  joe1     | sarah
  joe1     | tammy
  joe1     | lindsay
  celine6  | joe1
  celine6  | curtis
  </code></pre>
  
  <p>So for example if joe1 has decided he now wants to go under the username buffdude27 I tried to use the following query in node using the mysql middleware to change all instances of his name in the table:</p>
  
  <pre><code>var change = ['buffdude27', 'buffdude27', 'joe1', 'joe1'];
  connection.query('UPDATE likes SET liker = ? OR liked = ? WHERE liker = ? OR liked = ?', change, function(err, results){
  
  ...the actions I take after the query happens...
      });
  </code></pre>
  
  <p>The problem I'm having is that it will find all instances of joe1 and replace his username with a 0. What am I doing wrong and what is the proper way to do this? Thank you in advance for your help!</p>