Hey peeps. Let me try to make this simple. Right now I have a base db class that is moved solely for interacting with the db. It opens the connection, runs queries, and returns the results of those queries. Along with this class I've got some other classes (I'll call them "upper" classes) that are used to interact with different aspects of my project. For example I've got a Products class (used to add/delete products, etc.) and a Category class (used to add/delete categories, etc.).
Currently I'm extending the base db class into these "upper" classes. i.e. class DB { function dostuff () { } } class Products extends DB { function dothings () { $this->dostuff(); } } On this list I read a post that suggested I not do it this way but instead instantiate a DB object within each method of the "upper" class whenever necessary (as far as I understood the recommendation). This sounds like a good idea except that this would mean I'd be creating and destroying a DB object each time a method in an "upper" class needed to access the db. The way I'm doing it now requires that I only instantiate one object for the entire page and let any method in that "upper" class to share the connection. With my limited knowledge of OOP the only solution I can see would be to use a constructor in the "upper" class to instantiate the object when the "upper" class object is instantiated. Am I making sense and does anyone have any suggestions or comments to add? Maybe something to straighten me out? Thanks, Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php