亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

錯誤消息:調用未定義的方法 CI_DB_mysqli_result::results()

錯誤消息:調用未定義的方法 CI_DB_mysqli_result::results()

PHP
至尊寶的傳說 2022-06-17 14:18:09
我是 CodeIgniter 的新手,在連接 db 后遇到以下錯誤。如果有人可以幫助我,那真是太好了。我檢查了 StackOverflow 中以前的答案,但沒有一個對我有幫助。下面是控制器代碼    <?phpdefined('BASEPATH') OR exit('No direct script access allowed');class Welcome extends MY_Controller {    public function index() {        $this->load->view('home');    }    public function adminRegister() {        //loading teh queries model         $this->load->model('queries');        //Calling the getRoles function inside the roles        $roles = $this->queries->getRoles();        print_r($roles);        exit();        $this->load->view('register');    }    public function login() {        echo 'login';    }}型號代碼    <?php//Details of queries whicha re used to interact with teh databaseclass Queries extends CI_Model {//Created a function with the name getRoles      public function getRoles() {        //Fetch the reocrds from the table        $roles = $this->db->get('tbl_roles');        if ($roles->num_rows() > 0) {            return $roles->results();        }    }}?>目前不使用來自控制器的數據。任何幫助將不勝感激。提前致謝。
查看完整描述

1 回答

?
波斯汪

TA貢獻1811條經驗 獲得超4個贊

沒有結果應該是結果


參考CI 文檔


class Queries extends CI_Model {

    //Created a function with the name getRoles  

        public function getRoles() {

            //Fetch the reocrds from the table

            $roles = $this->db->get('tbl_roles');

            if ($roles->num_rows() > 0) {

                return $roles->result();

            }

        }


    }


查看完整回答
反對 回復 2022-06-17
  • 1 回答
  • 0 關注
  • 130 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號