I'm new. Below is the beginning of an attempt to interface with a database. Please let me know if the syntax is not correct, it seems to work on my localhost.
I think I could have typed class Database extends Mysqli, right? which would then have made the methods of Mysqli directly accessible to Database rather than through an instance created in the class itself. Would that have been preferable to what I have done?
class Database {
    #The variable that stores the database handle
    public $db;
    #The Database objects's datbase parameters
    public $host;
    public $user;
    public $password;
    public $database;
    #creates a Database object with the required databases details
    public function __construct($host, $user, $password, $database) {
        $this->host = $host;
        $this->user = $user;
        $this->password = $password;
        $this->database = $database;
    }
    #Stores the database handle as a var $db of the Database instance 
    public function connect() {
        if ($this->db = new Mysqli($this->host, $this->user, $this->password, $this->database)) {
            if ($this->db->connect_errno) {
                echo "No connection could be made <br/>";
            } else {
                echo "database succesfully connected <br/>";
            }
        }
    }
}
 
     
    