note 27593 added to function.die
| From: | duncanbeevers at attbi dot com | Date: | Thu, 12 Dec 2002 11:11:53 +0000 |
| Subject: | note 27593 added to function.die | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-40787@lists.php.net to get a copy of this message | ||
In many cases die() is too severe.
Often, trigger_error() using the E_USER_ERROR level will achieve the desired effect in a much tidier
fashion.
Like so:
mysql_connect("localhost", "user", "database", "pass") or
trigger_error("Could not connect to MySQL database", E_USER_ERROR);
Note: This will generate two errors. Since mysql_connect() is unsilenced (@) the connection failure
will issue a warning, while your trigger_error() call will issue a fatal error.
--
http://www.php.net/manual/en/function.die.php
http://master.php.net/manage/user-notes.php?action=edit+27593
http://master.php.net/manage/user-notes.php?action=delete+27593
http://master.php.net/manage/user-notes.php?action=reject+27593