Re: Opinion about the using $GLOBALS directly

From: Date: Wed, 19 Dec 2007 14:23:54 +0000
Subject: Re: Opinion about the using $GLOBALS directly
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-266077@lists.php.net to get a copy of this message
js wrote: > That wouldn't work well when you have to update multiple tables in a > transaction. > I think it's more maintainable to use GLOBALS than passing around dbh > to classes/functions. But you don't need to pass the dbh around to classes or functions, they can just call getDB when they need it and it will return the same connection and thus transactions will work fine. You did notice the "static" keyword in there right? Col.

« previous php.general (#266077) next »