Re: Exception vs exception
| From: | Chris | Date: | Fri, 22 Feb 2008 04:45:27 +0000 |
| Subject: | Re: Exception vs exception | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-269831@lists.php.net to get a copy of this message | ||
Prabath Kumarasinghe wrote:
Hi All Recently I'm came across following code snippet regarding exceptions there I'm executing invalid query and catch the exception as follows. First Approach ------------------------------------------- try{ $result = mysql_query('SELECT * from unknowntable'); }catch(exception $e){ echo $e->getTrace(); } -------------------------------------------Since mysql_query doesn't throw an exception, you cannot catch it. mysql_query returns false if an error occurs, otherwise it returns a result resource. http://www.php.net/mysql_query -- Postgresql & php tutorials http://www.designmagick.com/