host = $dbinfo['host']; $this->user = $dbinfo['user']; $this->pass = $dbinfo['pass']; $this->dbname = $dbinfo['name']; $this->connect(); } private function connect() { $this->conn = new mysqli($this->host, $this->user, $this->pass, $this->dbname); if ($this->conn->connect_error) { die("Connection failed: " . $this->conn->connect_error); } } public function query($query) { $stmt = $this->conn->prepare($query); $stmt->execute(); return $stmt->get_result(); } public function getRow($query) { $result = $this->query($query); return $result->fetch_assoc(); } public function debugGetRow($query) { echo "

Debug GetRow Query

"; echo "
Query: $query
"; $result = $this->query($query); $row = $result->fetch_assoc(); echo "
";
        print_r($row);
        echo "
"; die(); } public function getRows($query) { $result = $this->query($query); return $result->fetch_all(MYSQLI_ASSOC); } public function debugGetRows($query) { echo "

Debug GetRows Query

"; echo "
Query: $query
"; $result = $this->query($query); $rows = $result->fetch_all(MYSQLI_ASSOC); echo "
";
        print_r($rows);
        echo "
"; die(); } public function close() { $this->conn->close(); } }