For your production system, you probably want to turn off the PHP display_errors option. This can be done in php.ini, .htaccess via a php_flag setting, or in your script with a ini_set() function.
It is then up to you to trap any error conditions and handle them as desired. For instance, if you are connecting via mysql_connect():
$connx = mysql_connect($host, $user, $pwd);
if($connx === false)
{
// display error message, or set an error message variable for later use
}
Depending on your page/application design, you might just exit() after displaying an error message, or you might set the message in a session value and redirect to a generic error page that will output the error message from the session variable, call a custom display_error() function or method, etc.