How to display an error message generated from MySQL

@dbatesmdbctech gave an example here