我想在 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;
}
请帮我解决这个问题。
最佳答案
$this->db->where('editionId', $edid1);
$this->db->or_where('editionId', $edid2);
它在文档中是正确的 http://ellislab.com/codeigniter/user-guide/database/active_record.html
关于php - 如何使用 codeigniter 编写 'or' 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14561315/