not displaying error messages

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-19-2004
John Alleyman
 
Posts: n/a
Default not displaying error messages

Hi there,

Is there a simple way to prevent error messages (falsely connecting to
database etc.) being diplayed?
My own build in messages are enough...

thanks,
Chris


Reply With Quote
  #2 (permalink)  
Old 08-19-2004
Alvaro G Vicario
 
Posts: n/a
Default Re: not displaying error messages

*** 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 ;-)
--
Reply With Quote
  #3 (permalink)  
Old 08-19-2004
Markus Ernst
 
Posts: n/a
Default Re: not displaying error messages

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


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:57 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0