无法使用编码器点火器中的 where 和连接条件获取结果


unable to get the results using where and join condition in codeigniter

我试图得到像select * from bookdetails where display_id = $id with few foreign key join condition这样的结果

我已经编写了以下查询,但它显示错误如下:

致命错误:在 line432' 处调用 C:''xampp''htdocs''project 中非对象上的成员函数 num_rows(),即 *if ($query->num_rows()> 0)...

型号.php

public function get_all_book_list_atHomeTop($id, $limit, $start)
{
    $this->load->database();  
    $this->db->limit($limit, $start);  
    $this->db->get_where('bookdetails', array('display_id' => $id));  
    //-------join condition ------------------

    //------------Ends here Join condition  
    $query = $this->db->get(); 
    if ($query->num_rows() > 0)
    {
        foreach ($query->result() as $row)
        {
            $data[] = $row;
        }
        return $data;
    }
    return false;
}

get()函数中缺少表名:

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

或者你可以简单地用你开头get_where()语句替换它:

$query = $this->db->get_where('bookdetails',array('display_id'=>$id));