you said phpmyadmin
did you mean php?
because phpmyadmin is a piece of crap ('scuse my french) that should never be given to users
php is really good at trapping mysql error conditions and letting you construct your own error messages – there’s no need for a separate SELECT before your INSERT