|
Hello. I was wondering how can we add a piece of code to validate the data that is going to be entered within the database and then retrieve a nice error that there is a data duplication, so as to avoid the non-user friendly MySQL error..?
Is it possible for example to retrieve somthing like a pop-up error? Like the windows style error saying for example " There is data duplicatio" or "this record already exists in the database"..
I have set some fields as unique, not null..and when i have test it to add a duplicate record, i receive the following non-friendly mysql error:
"Failed to execute queryDuplicate entry 'piano' for key 1 SQL:SELECT * FROM `instrument_subject` WHERE 0 = 1"
|