Re: [PHP] Re: error-catching

2002-05-09 Thread Miguel Cruz

On Thu, 9 May 2002, Gert Mellak wrote:
>> If you just want to hide the error message, there's nothing wrong with
>> using @.
> 
> ok, it's a new point of view... I've always thought that this is bad
> programming style!

It's bad if you're using it to hide errors rather than fixing them.

If you have another reliable way of catching the same errors, then it's
fine.

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: error-catching

2002-05-09 Thread Andreas Indahl

use or die ("DB-server down"); at the end of you line.
"Gert Mellak" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> Hi!
>
> When I open a database connection and i. e. the db-server is down,
> I get a very long, long error message telling me that the server is down.
>
> What I want to do is just echo a text, i. e. "DB-Server down" and leave
out
> the error message.
>
> Does anyone have an idea how to manage this?
>
> I'd be grateful for any information!
>
> TIA,
>
> Gert.
> [EMAIL PROTECTED]
> http://mellak.com
>
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: error-catching

2002-05-09 Thread Gert Mellak

J Smith <[EMAIL PROTECTED]> schrieb in im Newsbeitrag:
[EMAIL PROTECTED]
>
> You can write your own error handlers using set_error_handler(). Then,
> depending on the error code, you can decide whether you should display the
> error message, email it to you, log it, whatever.
>
> http://www.php.net/manual/en/function.set-error-handler.php

thank you very much! this seems to be what I was looking for!

>
> If you just want to hide the error message, there's nothing wrong with
using
> @.

ok, it's a new point of view... I've always thought that this is bad
programming style!

Thank you for your hints!

Gert.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: error-catching

2002-05-09 Thread J Smith


You can write your own error handlers using set_error_handler(). Then, 
depending on the error code, you can decide whether you should display the 
error message, email it to you, log it, whatever.

http://www.php.net/manual/en/function.set-error-handler.php

If you just want to hide the error message, there's nothing wrong with using 
@.

J



Gert Mellak wrote:

>> $db_connect = mysql_connect($db_server, $db_user, $db_pass) or
> die('Couldn't
>> connect to database');
>>
>> $db_open = mysql_select_db($db_name, $db_connect) or die('Couldn't select
>> database');
> 
> well, I tried this out and if the mysql-server is down, I get the
> "Warning: Unable to connect to mysql-server"-stuff.
> 
> The only way I've found was to connect by @mysql_connect - but that's not
> the fine style, yeah?
> 
> Gert.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php