it is good practise setting error_reporting() to error_reporting(E_ALL) during development to show all errors including missed variables etc...
Once your script goes live, its advisable to turn all error reporting off to prevent people, or should i say "potential hackers" from getting any information about the error that occured. To turn error_reporting off use: error_reporting(0).
another useful function is trigger_error(), as it allows you to make your own error messages up. The good thing about it is that you can specify what error level reporting level (error, warning or notice) for that error to apply to, so you dont need to go through your script changing loads of stuff. e.g:
Code:
if (!$this->dbConn = @mysql_connect($this->host, $this->dbUser, $this->dbPass)) {
trigger_error('Could not connect to database server', E_USER_ERROR);
} elseif (!@mysql_select_db($this->dbName, $this->dbConn)) {
trigger_error('Could not select database', E_USER_ERROR);
}
of you used exit() or die() here the error message will always be displayed.
using trigger_error, if error reporting it turned off, the error message shouldnt appear.