title: Check if value appears twice in the same column in PHP using MySQL
body: <p>Lets say I have a table:</p>
  
  <pre><code>id | name | city
  ------------------
  1  | n1   | n1
  2  | n2   | c2
  3  | n3   | n3
  4  | n4   | c4
  </code></pre>
  
  <p>I want to check if a value already exists in a slot inside a column. </p>
  
  <p>Some values may appear multiple times in different columns but must not appear twice in the same column.</p>
  
  <p>So for example n1 appears  in <code>name</code> but also in <code>city</code> but I don't want it to appear in name or city twice.</p>
  
  <p>Using PDO</p>