Jump to content

OOP, database connection class help?


random1

Recommended Posts

Hi All,

 

I have a OO class in PHP in the file 'database.php' called 'Database' that includes methods that make a database connection, close it etc...

 

This class includes 2 main methods called 'executeQuery' and 'executePreparedStatement' (self explanatory).

 

The 'database' class is included in my file called 'index.php' and I need other included classes such as 'user' to be able to use 'executeQuery' and 'executePreparedStatement'.

 

In PHP how do you allow access to a mysqli object to another class? Can you simply pass it and then gain access to its methods?

Link to comment
https://forums.phpfreaks.com/topic/169026-oop-database-connection-class-help/
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.