Jump to content

include problem


pgm8705

Recommended Posts

I'm somewhat experienced with php as a scripting language, but I recently decided to make some of my web site more object oriented. I am very familiar with how OO works as I have had a lot of experience with java. My problem is this:

 

I have a class file called dataaccess.php. It is a object which accesses my database. Previously I had included it in the header of every single page. After going through and making objects for most things, I inlcuded it in the top of the class files which need it because this is how you would do things in other OO languages. My problem is that if i create 2 objects on the same page, I get a re-declaration error.

 

What is the appropriate way have classes use other objects without getting this error, and still keeping things modular and abstract?

Link to comment
https://forums.phpfreaks.com/topic/103770-include-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.