Php 代码点火器中的空结果

Php 代码点火器中的空结果,php,codeigniter,Php,Codeigniter,我想从我的模型中获取查询结果并在视图中使用它。我不知道为什么,但我的结果是空的。你能看看这个,告诉我我做错了什么吗 控制器: $peugeot = $this->input->post('peugeot'); $citroen = $this->input->post('Citroen C-Elysee'); $nissan= $this->input->post('Nissan Evalia'); $renault = $th

我想从我的模型中获取查询结果并在视图中使用它。我不知道为什么,但我的结果是空的。你能看看这个,告诉我我做错了什么吗

控制器:

    $peugeot = $this->input->post('peugeot');
    $citroen = $this->input->post('Citroen C-Elysee');
    $nissan= $this->input->post('Nissan Evalia');
    $renault = $this->input->post('Renault Trafic 9-os');
    $this->load->model('Edit_model');
    $this->Edit_model->peugeot($peugeot);
    if($peugeot)
    {
        $result = $this->Edit_model->peugeot($peugeot);
        $data['result'] = $result;
    }
型号:

    public function peugeot($peugeot)
    {
        $this->db->like('model', $peugeot, 'after'); 
        $query = $this->db->get('cars');
        $result = $query->result();
        return $result;
    }
视图:


有点奇怪,但它是有效的

我把控制器换成了这个

        $data['peugeot'] = $this->input->post('peugeot');
    $data['citroen'] = $this->input->post('citroen');
    $data['nissan'] = $this->input->post('nissan');
    $data['renault'] = $this->input->post('renault');
    $this->load->model('Edit_model');
    if($data['peugeot'])
    {
        $this->Edit_model->peugeot($data['peugeot']);
        $result = $this->Edit_model->peugeot($data['peugeot']);
        $data['result'] = $result;
        $this->load->view('content/editprocess',$data);
    }

在返回结果之前是否尝试过打印SQL?通过这种方式,您可以确认查询是否返回结果。ofc,在您的模型代码中,尝试执行var_dump($this->db->last_query());这将显示它是否与您想要的完全匹配。string(61)“选择*来自
汽车
WHERE
model
像'Peugeot%'ESCAPE'!”string(61)“选择*来自
cars
WHERE
model
像'Peugeot%'ESCAPE'!”我想我的if-in控制器有问题,但我不知道是什么。
        $data['peugeot'] = $this->input->post('peugeot');
    $data['citroen'] = $this->input->post('citroen');
    $data['nissan'] = $this->input->post('nissan');
    $data['renault'] = $this->input->post('renault');
    $this->load->model('Edit_model');
    if($data['peugeot'])
    {
        $this->Edit_model->peugeot($data['peugeot']);
        $result = $this->Edit_model->peugeot($data['peugeot']);
        $data['result'] = $result;
        $this->load->view('content/editprocess',$data);
    }