|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Using two classes?
I've written a class for my database connection and some other related mysql query functions. I also wrote a class for my template which is real simple, just basically the html code that I don't want to rewrite over and over.
I have them in their own file and I include them in my page, news.php. I make instances ( I guess that's the correct oop lingo) of each of the classes. Template first, database second. But it won't connect to the database. I copied all of the database class and put it in my templage class and it works just fine. My question is, can I make two instances of the classes... one of each class? Surely I can, I just don't get why it's not working. |
|
#2
|
||||
|
||||
|
Go ahead and post a little code so we can see what's going on. There's probably no need to post the classes -- just an excerpt from the file in which you're creating your instances.
|
|
#3
|
|||
|
|||
|
well for your DB you might have some code like,
Code:
include('db.php');
$DB = new DB;
$DB->connect();
so that is one class with 1 method being called. Use the same structure for your template class. I am assuming this is what your already doing. So you might post some code so we can help further. cheers
__________________
-- Jason |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Using two classes? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|