title: SQL IF NOT EXISTS - how to return/interpret when it does exist
body: <p>I have an IF NOT EXISTS statement.  IF it doesn't exist an INSERT statement follows.  IF EXISTS I need to understand what is/can be returned so that I can interpret it with PHP.</p>
  
  <p>so:</p>
  
  <pre><code>IF NOT EXISTS (SELECT id FROM users WHERE lname='SMITH')
  INSERT INTO users (lname='SMITH')
  </code></pre>
  
  <p>I thought that the negative would return no result so could use a standard</p>
  
  <pre><code>if ($result){echo "record added";}
  else {echo "duplicate - no record added";}
  </code></pre>
  
  <p>But that's not what's happening and I'm not sure how to achieve what I need - any suggestions?</p>
  
  <p>Thank you for your kind attention.</p>