Arrays 类的对象无法转换为类CI\u DB\u mysqli\u result的字符串

Arrays 类的对象无法转换为类CI\u DB\u mysqli\u result的字符串,arrays,database,codeigniter-3,Arrays,Database,Codeigniter 3,控制器: function index() { $this->load->helper(array('form', 'url','common')); $this->load->library(array('session','pagination')); $this->load->model('productsdisplay','',TRUE); $data=array( 'he

控制器:

function index()
   {
      $this->load->helper(array('form', 'url','common'));
      $this->load->library(array('session','pagination'));

      $this->load->model('productsdisplay','',TRUE);
      $data=array(   
         'header' => $this->load->view('frontend/assets/header', '', TRUE),  
         'footer' => $this->load->view('frontend/assets/footer', '', TRUE),
      );    


      $item= $this->input->get('products', TRUE);
        $newarray[]=array();
      $item_id  =$this->db->query('select id from  item where slug=(".$item.")');
        $result=$item_id->result();

      var_dump($result);

      $data['category']=$this->productsdisplay->getAllCategories($item_id);
      $data['kvas']=$this->productsdisplay->getAllKva();
      $data['items']=$this->productsdisplay->getAllItems();
      $data['applications']=$this->productsdisplay->getAllApplication();
      $data['products'] = $this->productsdisplay->getAllProduct();
      $data['ads'] = $this->productsdisplay->getAllAds();
      $insert_id=$this->productsdisplay->addEnquiry($this->input->post());

      $this->load->view('frontend/product/index',$data);
   }
型号:

   function getAllCategories($item_id)
    {
        if($item_id!=''){
       $this->db->select('category_name');
       $this->db->order_by("category_name", "ASC");
       $query = $this->db->where('product_type',$item_id);
       $query = $this->db->get('category');
       return $query->result(); 
     }
    }
我无法理解如何解决这个错误。请帮我解决这个问题。
我是CI的初学者。

获取
$item\u id
的查询是错误的。它应作如下更改

$item_id  =$this->db->query('select id from  item where slug='.$item);

获取
$item\u id
的查询错误。它应作如下更改

$item_id  =$this->db->query('select id from  item where slug='.$item);

获取$item\u id的查询出错。获取$item\u id的查询出错。