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/

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

Reply via email to