<?php
class database
{
    public $connection;

    function __construct()
    {
        $this->connection = mysqli_connect(
            "localhost",
            "root",
            "8141113900A@a",
            "aws_covt"
        ) or
            die('Database Connection Error: ' . mysqli_connect_error());
    }

    public function close_database()
    {
        return mysqli_close($this->connection);
    }
    public function query($query)
    {
        $query = mysqli_query($this->connection, $query) or die('Query Execution Error: ' . mysqli_error($this->connection));
        return $query;
    }
    public function fetch_assoc($query)
    {
        $query = mysqli_fetch_assoc($query);
        return $query;
    }

    public function fetch_all($query)
    {
        $query = mysqli_fetch_all($query,MYSQLI_ASSOC);
        return $query;
    }

    public function lastinssertId(){
        return mysqli_insert_id($this->connection);
    }

}

$db = new database();
