0

我想写一个像select*from bookdetails where editionId=$edid1 or editionId=$edid2;Codeigniter 查询一样的查询。

下面是我的 Codeigniter 查询

     public function get_rare_outofprintBooks($edid1,$edid2) 
     {
        $this->load->database();   
        $query = $this->db->get_where('bookdetails',array('edition_id'=>$edid1),array('edition_id'=>$edid2));  //i tried like this but its NOT Working  

   if ($query->num_rows() > 0)
        {
            foreach ($query->result() as $row)
            {
                $data[] = $row;
            }
            return $data;
        }
        return false;
   }

请帮我解决这个问题。

4

2 回答 2

4
$this->db->where('editionId', $edid1);
$this->db->or_where('editionId', $edid2); 

就在文档http://ellislab.com/codeigniter/user-guide/database/active_record.html

于 2013-01-28T11:48:33.560 回答
3
$this->db->where('id',3);
$this->db->or_where('id',5);

参考这里

于 2013-01-28T11:47:16.420 回答