Jump to content

include functions in a class!


webbhelp

Recommended Posts

Hi!

 

I have a class with many functions/methods. I want to split this into different files so I can easily edit and add functions.

I want every functions to be able to call eachother and with that I mean, they have to be for example in same document.

 

My question is: I can't have a class and include functions like this:

 

class DB
{

include('select_functions.php'); //Only includes function's no class
include('insert_functions.php'); //Only includes function's no class
include('delete_functions.php'); //Only includes function's no class

function test()
{

}

}

 

The includes will output fatal errors...

 

How can I solve this so I can have all functions in different files but still use ONE object to call them!

 

Thanks!

Link to comment
Share on other sites

You're going about this the wrong way.  Classes can't be split up like you want them to be.  If you feel your class is flawed due to its length, you should look into refactoring it into other, smaller classes.

 

In any event, you're also trying to reinvent the wheel when PHP already has several OOP database options available to use - MySQLi and PDO.  Look into them to see if they'd fit your needs.

Link to comment
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.