Re: Apply an Error-Handler to all PEAR::DB Querys
| From: | xavier | Date: | Thu, 05 Jun 2003 12:16:22 +0000 |
| Subject: | Re: Apply an Error-Handler to all PEAR::DB Querys | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-5821@lists.php.net to get a copy of this message | ||
akorthaus@web.de wrote:
Hi! It would be nice to have one global error-handler for DB-queries with PEAR::DB. Now I must use something like that for each query: $result = $db->query('SELECT...'); if (DB::isError($db)) { die ($db->getMessage()); } But I would like to have a global handler, so every time I send a query to my database, $db is checked for errors, without writing it down after each query. How could I do this? kind regards Andreas Hi,you can use the Pear Error handler usefull links: http://pear.php.net/manual/en/core.pear.pear.seterrorhandling.php http://www.php-mag.net/itr/online_artikel/psecom,id,330,nodeid,114.html regards -- Xavier