Using my database class with other classes in my project

adrianseoul

New Member
I have a custom database class that I wrote myself, and I also have a user class and a site class.The MySQL class has methods like this:\[code\]connectquerycleanfetch\[/code\]The user class:\[code\]registerloginlogoutresetPass\[/code\]The site class:\[code\]updateTopicsaddTopicaddPostaddReply\[/code\]etc.These classes need to interface with a database, which is what I wrote the MySQL class for. But, I have no idea how to properly use the MySQL class with these classes. Do I define the class as global and just reference it in the other classes? Do I do something like:\[code\]$db = new MySQL();$user = new User($db);\[/code\]and then reference it like that?Any help is appreciated, thank you. :)
 
Back
Top