Hello everyone,
I'd like to make a small object oriented login system. The problem is that I'm not very good at oop and i have only written these scripts the procedural way.
So please, correct me if I'm wrong:
class database
- connect()
class user
- login()
My problem is when i make a database connection in connect(), I can't use it in login().
class Database{
public function connect(){
$mysqli = new mysqli('localhost','root','','login');
}
}
class User{
public function login(){
// how do i use connect() from above and make a query to log the user in?
}