我想在Codeigniter查询中编写类似select*from bookdetails where editionId=$edid1 or editionId=$edid2;
的查询。
以下是我的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;
}
请帮我解决这个问题。
答案 0 :(得分:4)
$this->db->where('editionId', $edid1);
$this->db->or_where('editionId', $edid2);
在文档http://ellislab.com/codeigniter/user-guide/database/active_record.html
中正确答案 1 :(得分:3)
$this->db->where('id',3);
$this->db->or_where('id',5);
参考Here