[nycphp-talk] Combining Auth with DB
David Mintz
dmintz at davidmintz.org
Mon Aug 9 09:46:33 EDT 2004
On Sun, 8 Aug 2004, Matthew Terenzio wrote:
> If i'm using Auth with DB on top of a page and I need DB access for
> other objects on the page, am I duplicating the connection
> unnecessarily. In other words, can they both use the same handle and
> how might I achieve that.
if (! is_null($a->storage->db)) {
$db =& $a->storage->db;
//echo "got a " . get_class($db)." from my Auth object (-:<br />";
} else {
$db = DB::connect(DSN);
}
This might not be PHP5-proof but for now, worksforme.
HTH
---
David Mintz
http://davidmintz.org/
"Anybody else got a problem with Webistics?" -- Sopranos 24:17
More information about the talk
mailing list