Does that mean for every exception do we have to write
our custom exception and describe it from our own
message
Cheers
Prabath
--- Paul Scott <[EMAIL PROTECTED]> wrote:
>
> On Wed, 2008-02-06 at 23:10 -0800, Prabath
> Kumarasinghe wrote:
> > Is this following code work in PHP if
> mysql_connect
> > fails.
> >
> > try{
> > mysql_connect('localhost','user','');
> >
> > }catch(Exception $e){
> > echo $e->getMessage();
> >
>
> Probably not. I don't think that the mysql functions
> throw exceptions on
> failure.
>
> You will have to write a wrapper function to do the
> exception on
> failure, so something like
>
> function dbConnect()
> {
> $conn = mysql_connect('','','');
> if(!$conn) {
> throw new Exception("Couldn't connect");
> }
> else {
> return $conn;
> }
> }
>
> > All Email originating from UWC is covered by
> disclaimer
>
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm
>
>
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php