title: MySQL condition for inserting a record if not exists
body: <p>I'm trying to get the most work easier. This is a finding that the record in the database and eventually, if not, then create it.</p>
  
  <p>Here is my command MySQL:</p>
  
  <pre><code>IF NOT EXISTS( SELECT * FROM USERS
                 WHERE
                       name = '$this-&gt;m_name'
                   AND email = '$this-&gt;m_email'
               ) 
    BEGIN
       INSERT INTO `USERS` (`id`, `name`, `email`, `phone`, `text`, `type`)
       VALUES (NULL, '$this-&gt;m_name', '$this-&gt;m_email', '$this-&gt;m_phone', '', '');
    END
  </code></pre>
  
  <p>For reasons not known to me, it did not work.</p>