This is a discussion on not displaying error messages within the PHP Language forums, part of the PHP Programming Forums category; Hi there, Is there a simple way to prevent error messages (falsely connecting to database etc.) being diplayed? My own ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
*** John Alleyman wrote/escribió (Thu, 19 Aug 2004 08:11:37 +0200):
> Is there a simple way to prevent error messages (falsely connecting to > database etc.) being diplayed? Preppend a @ symbol to the offending line: $conn=@mysql_connect($server, $user, $password) or die('System not available'); You could also change error_reporting in php.ini but that would make it almost impossible to debug scripts. -- -- Álvaro G. Vicario - Burgos, Spain -- Questions sent to my mailbox will be billed ;-) -- |
|
|||
|
Alvaro G Vicario <alvaro_QUITAR_REMOVE@telecomputeronline.com> schrieb:
> *** John Alleyman wrote/escribió (Thu, 19 Aug 2004 08:11:37 +0200): >> Is there a simple way to prevent error messages (falsely connecting >> to database etc.) being diplayed? > > Preppend a @ symbol to the offending line: > > $conn=@mysql_connect($server, $user, $password) > or die('System not available'); > > You could also change error_reporting in php.ini but that would make > it almost impossible to debug scripts. I usually use error_reporting(E_ALL) for debugging and error_reporting(0) for online running mode. Just write both commands at the top of your file (if you have an include in all scripts such as a db login file: put them there) and comment out the one that you don't want to be active. Even if you have your own error messages it is quite useful to see the original ones for debugging. HTH Markus |