Re: Re: passing a mysqli object via globals

From: Date: Mon, 03 Dec 2007 20:58:32 +0000
Subject: Re: Re: passing a mysqli object via globals
References: 1 2 3 4 5  Groups: php.db 
Request: Send a blank email to php-db+get-44382@lists.php.net to get a copy of this message
Dee Ayy wrote:
On Dec 3, 2007 10:26 AM, julian <correojulian33-php@yahoo.es> wrote:
Dee Ayy wrote:
Hopefully your only issue is the keyword global versus globals ?
Not sure what you mean. global $db should bring to local scope a reference to the object that has the data base connection. PHP complaints that it cannot access properties or methods of that object in the obj/f1/ scope.... I tried using the $GLOBALS['db'] with same results.....
In the one that failed, you used the invalid keyword "globals". In the one that worked, you used the valid keyword "global". When I said "hopefully", I was wondering if you could use $GLOBALS['db'] but there may be other issues since you said that also failed.
no worries.... I give up. It is really weird I know.... Hope some day I will get enlighted. In one file, any method within a class is happy with the global $db...on a different (same file !!!) class no method is happy with accessing $db via global... I will open and close db connection in each method that it needs... awkward...but works. Thanks for your time.

« previous php.db (#44382) next »