PHP classes
Posted: Mon Oct 07, 2002 10:18 pm
Hi All,
Although I am not so new to PHP (not expert either), this is the first time
for me to use PHP class.
I am starting a project, and plan to use partially OOP and partially
traditional programming. I use PHP/MySQL. I have one class, DB_Do, which does every thing to do with database, and several other classes. When I start my design, I realized that very often, other classes need to access database, eg. I have an "Access_Control" class which controls all accesses to pages in the application. One of methods in this class is to
authenticate the user login via user name and password stored in the
database. I am not sure if I should use an object of DB_Do within the
method of Access_Control or write separate code to access the database for the user name and password. It seems that I loose purpose of OOP if I write the separate code. However, I am not sure if creating the object within other class is efficient?
I would appreciate if some one there could give me some suggestions about this.
Thanks in advance.
Ruth
Although I am not so new to PHP (not expert either), this is the first time
for me to use PHP class.
I am starting a project, and plan to use partially OOP and partially
traditional programming. I use PHP/MySQL. I have one class, DB_Do, which does every thing to do with database, and several other classes. When I start my design, I realized that very often, other classes need to access database, eg. I have an "Access_Control" class which controls all accesses to pages in the application. One of methods in this class is to
authenticate the user login via user name and password stored in the
database. I am not sure if I should use an object of DB_Do within the
method of Access_Control or write separate code to access the database for the user name and password. It seems that I loose purpose of OOP if I write the separate code. However, I am not sure if creating the object within other class is efficient?
I would appreciate if some one there could give me some suggestions about this.
Thanks in advance.
Ruth