In my project, I have a database class that I use to process all the MySQL stuff. It connects to the database, starts queries, catches errors and closes the connection.
Now I need to create a member area on my site, and I'm going to create a user class that will handle registration, login, password / username / reset, and logout changes. In this user class, I need to use MySQL for obvious reasons ... for which my database class was created.
But I am confused about how I will use my database class in my user class. Should I create a new database object for my custom class and then close it whenever the method in this class is completed? Or am I somehow creating a “global” database class that can be used throughout my script (if so, I need help with this, I don’t know what to do there.)
Thanks for any feedback you can give me.
object database php class
Josh
source share