Dylan Junior Member
 
![[Avatar]](http://corexhost.com/advertisements/corexhostavatar.gif) Posts: 136 Status: Offline Gender: Male Joined:
pmwwwmsnaimxfire | Using methods from one class in another class (25th Mar 08 at 8:26pm UTC) how do i use the method of one class in another class? | | Ok I have 2 classes a Database class and Miscellaneous class, The database class has mysql connection info and all the methods I use. I then have a miscellaneous class which has random methods I use. The problem is I need the miscellaneous class to use methods in from the database class. But I don't know how to create a new class int htere like the usual thing to do is $db =new Database;
if I try that I get this
Quote: arse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /home/djago/public_html/socialnetworking/framework/misc.php on line 3
if I add this line var $db =new Database;
Quote: Parse error: syntax error, unexpected T_NEW in /home/djago/public_html/socialnetworking/framework/misc.php on line 3
What do I do? | |
|
|
Mithras Junior Member
 
Posts: 67 Status: Offline Gender: Male Location: Pittsburgh, PA Age: 33 Joined:
pm | Re: Using methods from one class in another class (25th Mar 08 at 9:13pm UTC) | | I think I answered this on PBS, but just in case anyone here has the same question, you would do something like this:
$db = new Database(); $db->method(); | |
|
Dylan Junior Member
 
![[Avatar]](http://corexhost.com/advertisements/corexhostavatar.gif) Posts: 136 Status: Offline Gender: Male Joined:
pmwwwmsnaimxfire | Re: Using methods from one class in another class (25th Mar 08 at 10:44pm UTC) | | Thank you | |
|
|
Mithras Junior Member
 
Posts: 67 Status: Offline Gender: Male Location: Pittsburgh, PA Age: 33 Joined:
pm | Re: Using methods from one class in another class (26th Mar 08 at 12:14am UTC) | | Glad to help | |
|