【发布时间】:2019-07-31 10:58:10
【问题描述】:
我的$temp like(7,8,9) 中有多个 ID,我想比较我的 where 条件中的 ID,例如 $this->db->where_in('c.mr_no',$temp);,但它只比较第一个 ID
我正在尝试这样:
控制器:
public function printCollectionRecPage()
{
$this->load->view('template/header');
$this->load->view('template/sidebar');
$temp =($_GET['id']);
$data = array();
$data['collnR'] = $this->PayRecAllModel->printCollectionRecPage($temp);
$this->load->view('crossing/payment_rec_allocation/printCollectionRecovery',$data);
$this->load->view('template/footer');
}
型号:
public function printCollectionRecPage($temp)
{
$this->db->select('c.*,payment_rec_allocn.*');
$this->db->from('crossing_cash_memo c');
$this->db->join('payment_rec_allocn', 'payment_rec_allocn.mr_no = c.mr_no');
$this->db->where('c.total !=','0');
$this->db->where('c.mr_no',$temp);
$query = $this->db->get();
return $query->result();
}
我想在 where 条件下比较所有 3 个 id。
【问题讨论】:
-
$this->db->where_in('c.mr_no',$temp);。确定$temp = array(7,8,9); -
@AnantSingh---AlivetoDie 我使用 where_in
$this->db->where_in('c.mr_no',$temp);但它仍然只比较第一个 id(7) -
@farhantechno 那么它是什么?是像
$temp ="7,8,9"这样的字符串吗? -
@farhantechno 你是如何存储它们的?向我们展示该代码。
标签: php mysql sql codeigniter