General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 25th, 2003, 11:35 PM
eqjones eqjones is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: South Carolina
Posts: 18 eqjones User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old September 26th, 2003, 07:47 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
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.

Reply With Quote
  #3  
Old September 26th, 2003, 07:26 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Using two classes?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT