Using Objects with Databases
| From: | Philip Zee | Date: | Wed, 22 Jan 2003 05:26:32 +0000 |
| Subject: | Using Objects with Databases | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-25030@lists.php.net to get a copy of this message | ||
Hello all,
I am trying to create a class, say User. Each user has an entry in the database
table called user. Each function, including the constructor, will be calling
the database to do something. Is it better to initialize the database
connection inside each function or is it better to initialize the connection at
the beginning of the class? What's the best practice on this?
Any help or example is appreciated.
Thanks,
Philip