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:
connect
query
clean
fetch
The user class:
register
login
logout
resetPass
The site class:
updateTopics
addTopic
addPost
addReply
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:
$db = new MySQL();
$user = new User($db);
and then reference it like that?
Any help is appreciated, thank you. :)