Thanks Wilmar, for sharing your experience with me.  My problem now is that
I have already got a class to do every thing related to database.  If I
don't use this DB class within other classes, I will have a lot of
duplicated code.  If I do use the DB class within other classes, I am not
sure if it is efficient.

Thanks again.


----- Original Message -----
From: "Wilmar Perez" <[EMAIL PROTECTED]>
Sent: Tuesday, October 08, 2002 11:53 AM
Subject: Re: [PHP-DB] access DB via PHP classes

> Well, I'll tell you what I do.
> I'm not a OOP expert so if someone feel like I'm doing it wrong I'll
> any comment about .
> I've got a main class which I use to generate every page in my website
> are actually generated by inherited classes but that's the main idea).  As
> need a database conection for every page I write the connection threat in
> main class constructor using mysql_pconnect which handles a persistent
> connection.
> So far it is workin alright for me.  As I said before any comments will be
> welcome.
> Hope it helps
> *******************************************************
>                          Wilmar Pérez
>                      Network Administrator
>                        Library System
>                       Tel: ++57(4)2105145
>                     University of Antioquia
>                        Medellín - Colombia
>                               2002
> *******************************************************
> --
> PHP Database Mailing List (
> To unsubscribe, visit:

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

Thanks in advance.


PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to