NYCPHP Meetup

NYPHP.org

[nycphp-talk] database handles

Matthew Terenzio webmaster at localnotion.com
Thu Sep 30 20:27:22 EDT 2004


Say you've got a couple classes which at times need to read and insert 
from a DB.
These classes will be instantiated within pages on the site.
I'm thinking of  using a database class which gets instantiated on 
every page which might need it, then pass the handle as an object to 
the other classes to use.
This seems to work fine. I just feel funny about having classes lying 
around which rely on another class having been instantiated somewhere 
upwards on a page.

Will using Pear DB,  if you call DB:: connect() twice on a page, will 
it open two connections to the database?





More information about the talk mailing list