PHP Classes

Should my class connect to the Database

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  Should my class connect to the Database  
Subject:Should my class connect to the Database
Summary:Should the class make a database connection
Messages:3
Author:Wayne May
Date:2009-07-22 16:23:03
Update:2009-07-22 21:40:06
 

  1. Should my class connect to the Database   Reply   Report abuse  
Picture of Wayne May Wayne May - 2009-07-22 18:35:52
I have been programming in PHP for over 6 years now. About two years ago I had to switch to .NET 2.0 for work reasons. I am back, developing in PHP and I a question that's been bugging me for a while.

When I develop a class in PHP (lets say, a class for Members), should the class make a database connection to get information about a member? Or should the class simply act as a container with the variables and some essential functions for that member?

Which works best?

There are 2 replies in this thread, which are not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.