RE: [PEAR] Question about scope with functions and PEAR

From: Date: Mon, 03 Feb 2003 19:42:11 +0000
Subject: RE: [PEAR] Question about scope with functions and PEAR
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-12956@lists.php.net to get a copy of this message
> Using the following at the top of my page: > > require_once "/usr/local/share/pear/DB.php"; > > works great for any DB calls that are NOT inside a function. How do I > make this work inside my functions and get access to all the PEAR > classes without having to include the DB.php again and again in all of > my functions? > > > Baffled by scope yet again! > > Thanks for any assistance! > > Cory If your DB object var is "$db", try adding ------------ global $db; ------------ inside your function block. That's it... Regards, Lorenzo --- [Quipo ISP - Questa E-mail e' stata controllata dal programma Declude Virus] [Quipo ISP - This E-mail was scanned for viruses by Declude Virus]

« previous php.pear.dev (#12956) next »