是否需要将__construct中的连接变量插入mysqli_query中?

I'm starting to make a PHP class for a database connection, i've made a constructor and in that constructor i make the connection to the database.

class mysqli_db{

        function __construct()
        {
            $conn = mysqli_connect("ip","username","password");

            if (!$conn) {
                echo "Cannot connect to server";
                exit();
            }

            $db = mysqli_select_db($conn,"silvaag166_prj");

            if (!$db) {
                echo "Cannot select database";
                exit();
            }
        }

    }

I understand de part above but now i want to make a function to select data from the database so i've made this:

public function selectAll($tablename)
        {
            return mysqli_query(?,"SELECT * FROM ".$tableName);
        }

At the ? i need to add the connection string and that can be found in the constructor. How do i need to insert the connectionstring at the ?.

Store the connection as a class property, it will then be available to the whole class i.e. all its methods as $this->conn

class mysqli_db{
    private $conn;

    function __construct()
    {
        $this->conn = mysqli_connect("ip","username","password");

        if (!$this->conn) {
            echo "Cannot connect to server";
            exit();
        }

        $db = mysqli_select_db($this->conn,"silvaag166_prj");

        if (!$db) {
            echo "Cannot select database";
            exit();
        }
    }

    public function selectAll($tablename)
    {
        return mysqli_query($this->conn,"SELECT * FROM ".$tableName);
    }

}

You should use $this->conn

class mysqli_db{
    private $conn;

    function __construct()
    {
        $this->conn = mysqli_connect("ip","username","password");

        if (!$this->conn) {
            echo "Cannot connect to server";
            exit();
        }

        $db = mysqli_select_db($this->conn,"silvaag166_prj");

        if (!$db) {
            echo "Cannot select database";
            exit();
        }
    }

    public function selectAll($tablename)
    {
        return mysqli_query($this->conn,"SELECT * FROM ".$tableName);
    }

}