in reply to Re: Re: Re: multiple db connects
in thread multiple db connects

So that's the behavior I'm trying to understand about die. If it is going to cause the program to bomb, then it seems like (especially for CGI) a much better idea to me (both in terms of user-friendly solutions and in terms of code re-usability) to build the function in such a way that it returns a false value if it fails. That way the function doesn't kill the whole process (i.e. HTTP result code 500) and it can be used in statements like
$foo = biff($bap) || 'Bar'; or if ($dbh = handle($db)) { do_something($dbh); } else { dont(); }
(for instance).

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: multiple db connects
by merlyn (Sage) on Dec 21, 2000 at 21:55 UTC