note 27593 deleted from function.die by didou
| From: | didou@php.net | Date: | Sun, 18 May 2003 10:59:08 +0000 |
| Subject: | note 27593 deleted from function.die by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-48514@lists.php.net to get a copy of this message | ||
Note Submitter: duncanbeevers@attbi.com
----
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.