致命错误:调用未定义方法CI_DB_mysqli_result::fetch()


Fatal error: Call to undefined method CI_DB_mysqli_result::fetch()

    public function getVoters($limit = 5)
    {
        $db = $this->load->database("cms", true);
                $year = date('Y');
                $month = date('n');
                $res = $this->db->query("SELECT account, counter FROM votecounter WHERE year=$year AND month=$month ORDER BY counter DESC LIMIT 5");
                $x = 1;
                while ($arr = $res->fetch())
                {
                    $accid = $arr['account'];
                    $res2 = $DB->prepare("SELECT `displayName` FROM `account_data` WHERE `id` = :acc LIMIT 1;");
                    $res2->bindParam(':acc', $accid, PDO::PARAM_STR);
                    $res2->execute();
                    $arr2 = $res2->fetch();
                    echo '
                        <li>
                            <p>', $x ,'</p>
                            <a href="', $config['BaseURL'], '/index.php?page=profile&uid=', $accid, '">', $arr2['displayName'] ,'</a>
                            <span>', $arr['counter'] ,' <i>Votes</i></span>
                        </li>';
                    $x++;
                    unset($res2, $arr2, $accid);
                }
                unset($res, $x);    
}

这曾经在我的PHP网站上工作,但是我改成了一个用Smarty/Codeigniter构建的新网站,这个错误一直出现,我不知道如何修复它。

致命错误:调用未定义方法CI_DB_mysqli_result::fetch()

如果我没有弄错的话,codeigniter中没有fetch()函数。

那就用result_array()