title: MySQL query Question?
body: <p>I'm trying to stop members from adding them selves as a friend but I can't seem to get it to work the last line of code in my MySQL query <code>AND '$user_id' &lt;&gt; '$friend_id'</code>
  is trying to check if the user id is the same as the friend id and if so stop running the query but for some reason the code will still run. </p>
  
  <p>How do I fix this so the query stops running when the user tries to add themselves as a friend?</p>
  
  <p>Here is the MySQL query.</p>
  
  <pre><code> SELECT *
   FROM friends
   WHERE user_id = '$user_id'
   AND friend_id = '$friend_id'
   AND '$user_id' &lt;&gt; '$friend_id'
  </code></pre>
  
  <p>Here is the MySQL table.</p>
  
  <pre><code>CREATE TABLE friends (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  user_id INT UNSIGNED NOT NULL,
  friend_id INT UNSIGNED NOT NULL,
  PRIMARY KEY (id),
  );
  </code></pre>