general OO php question
| From: | Kirk Babb | Date: | Mon, 06 Oct 2003 23:57:07 +0000 |
| Subject: | general OO php question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-165255@lists.php.net to get a copy of this message | ||
If I have a class called Registration, should I code in the mysql_connect
inside each function inside the class that needs it, or should I make a
function called dbConnect? If so, how can I correctly call dbConnect inside
the other functions of the class?
would it be something like this? Or am I not thinking "OO-ishly" - add "f"
and "l" and it might be right ;)
class Registration {
function dbConnect() {
mysql_connect(host,usr,pwd);
}
function register($usr, $email, $pwd) {
dbConnect();
other code to handle the insertion of data
}
}
TIA -Kirk