Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Codeigniter遇到未捕获的异常_Php_Codeigniter_Get - Fatal编程技术网

Php Codeigniter遇到未捕获的异常

Php Codeigniter遇到未捕获的异常,php,codeigniter,get,Php,Codeigniter,Get,当连接到具有联接的表时,我在thsi函数中遇到错误 我发现的错误 遇到未捕获的异常类型:错误消息:调用 未定义的方法CI_DB_mysqli_驱动程序::select() 我的代码是: public function get_data($table,$where='',$select='',$join='',$limit='',$start=NULL,$order_by='',$group_by='',$num_rows=0,$csv='') //selects data from a tabl

当连接到具有联接的表时,我在thsi函数中遇到错误

我发现的错误

遇到未捕获的异常类型:错误消息:调用 未定义的方法CI_DB_mysqli_驱动程序::select()

我的代码是:

public function get_data($table,$where='',$select='',$join='',$limit='',$start=NULL,$order_by='',$group_by='',$num_rows=0,$csv='') //selects data from a table as well as counts number of affected rows
    {


        // only get data except deleted values
        // $col_name=$table.".deleted";
        // if($this->db->field_exists('deleted',$table) && $show_deleted==0)
        // $where['where'][$col_name]="0";

        $this->db->select($select);
        $this->db->from($table);

        if($join!='')                   $this->generate_joining_clause($join);      
        if($where!='')                  $this->generate_where_clause($where);

        if($this->db->field_exists('deleted',$table))
        {
            $deleted_str=$table.".deleted";
            $this->db->where($deleted_str,"0");
        }

        if($order_by!='')               $this->db->order_by($order_by);
        if($group_by!='')               $this->db->group_by($group_by);




        if(is_numeric($start) || is_numeric($limit))
            $this->db->limit($limit, $start);

        $query=$this->db->get();

        if($csv==1)
        return $query; //csv generation requires resourse ID

        $result_array=$query->result_array(); //fetches the rows from database and forms an array[]

        if($num_rows==1)
        {
            $num_rows=$query->num_rows(); //counts the affected number of rows
            $result_array['extra_index']=array('num_rows'=>$num_rows);  //addes the affected number of rows data in the array[]
        }

        // print_r($this->db->last_query());
        return $result_array; //returns both fetched result as well as affected number of rows 

}

我在谷歌上搜索了这个问题,我发现问题出在什么时候,但我已经找到了它。有任何帮助吗?

请确保您的模型正在扩展代码CI_模型,并且您正在将数据库驱动程序加载到config文件夹下的autoload.php中。

是否已将数据库加载到controller或autoload中。php@pradeep是的,它装了东西,因为它我觉得很奇怪!还显示访问
获取数据的位置