Re: access DB via PHP classes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Ruth


----- Original Message -----
From: "Wilmar Perez" <wilmar.perez@caribe.udea.edu.co>
To: <php-db@lists.php.net>
Sent: Tuesday, October 08, 2002 11:53 AM
Subject: Re:  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
welcome
> any comment about .
>
> I've got a main class which I use to generate every page in my website
(some
> are actually generated by inherited classes but that's the main idea).  As
I
> need a database conection for every page I write the connection threat in
the
> 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 (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux