Using a database class in my user class

前端 未结 6 622
慢半拍i
慢半拍i 2021-02-09 01:00

In my project I have a database class that I use to handle all the MySQL stuff. It connects to a database, runs queries, catches errors and closes the connection.

Now I

6条回答
  •  星月不相逢
    2021-02-09 01:25

    As he said, put all your functions in the database class and use the database object to access those functions from your user class. This should be the best method in your case. Eg:
    global $database;
    userclassvar = $database->doSomething();

提交回复
热议问题