I have two unique keys 'phone' and 'email'. When a duplicate key is getting inserted I'm getting the error posted below:
Integrity constraint violation: 1062 Duplicate entry '4294967295-xyz@gmail.com' for key 'phone'
What I'm trying to do is display the thrown error to the user like posted below:
1. Duplicate entry '4294967295' for key 'phone'
2. Duplicate entry 'xyz@gmail.com' for key 'email'
How can I do that?
Here's what I have done to get the error displayed on front-end:
catch( PDOException $Exception ){
if ($Exception->errorInfo[1] == 1062) {
echo 'ERROR: ' . $Exception->getMessage();
}
}