PHP - multiple classes (connecting/using DB in another class)


#1

I have a Database class and a “Bootstrap” class, I want to use the DB class in my “Bootstrap” class, how would I do this? Thanks.


#2

Not sure what you mean by “class”. Do you mean you created two actual classes? If so, they are individual entities. If the database class is in it’s own file, you would use a PHP include command to add it into another file. If that is what you mean Use something like this:
php include(“database.php”); whatever your filename is.

If you mean you created a function, do it the same.

Otherwise, show some sample code of each file inside PHP tags above.
(Do not need all the code, just some idea of what you are talking about.)

Good luck…