This question already has an answer here:
- How to 'insert if not exists' in MySQL? 9 answers
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.
Here is my command MySQL:
IF NOT EXISTS( SELECT * FROM USERS
WHERE
name = '$this->m_name'
AND email = '$this->m_email'
)
BEGIN
INSERT INTO `USERS` (`id`, `name`, `email`, `phone`, `text`, `type`)
VALUES (NULL, '$this->m_name', '$this->m_email', '$this->m_phone', '', '');
END
For reasons not known to me, it did not work.
</div>