When I enter duplicate field I get php error Error Code: 1062. Duplicate entry 'someValue' for key 'someField'
I wonder, how can I modify or parse in Php this error to something like
The someField you are trying to insert is linked to another user
someField
can be different - phone number, bank account, email.
Here is my code that returns error if it exist.
if (!$connection->getConnection()->query($sql) ) {
return $connection->getConnection()->error;
};
I found same question, but it is for Go
language.