Welcome Guest, Not a member yet? Register   Sign In
some problem with $this->db->or_where_in and $this->db->where_in
#1

[eluser]Unknown[/eluser]
function closedprojects(){
$brandcheck=$this->brandcheck($this->session->userdata('member_id'));
$this->db->from('tbl_baf');
$this->db->where_in('tbl_baf.brands', $brandcheck);
$this->db->or_where_in('tbl_baf.other_brands', $brandcheck);
$this->db->where('tbl_baf.status','closed');
$this->db->join('tbl_expense', 'tbl_baf.p_id=tbl_expense.project_id');
$this->db->join('tbl_brand', 'tbl_expense.brand_id=tbl_brand.b_id','left');
$query = $this->db->get();
return $query->result();
}

this is the mysql version of the CI query

SELECT * FROM (`tbl_baf`) JOIN `tbl_expense` ON `tbl_baf`.`p_id`=`tbl_expense`.`project_id` LEFT JOIN `tbl_brand` ON `tbl_expense`.`brand_id`=`tbl_brand`.`b_id` WHERE `tbl_baf`.`brands` IN ('4', '3', '5', '1', '2') OR `tbl_baf`.`other_brands` IN ('4', '3', '5', '1', '2') AND `tbl_baf`.`status` = 'closed' GROUP BY `tbl_baf`.`p_id`


my problem is " `tbl_baf`.`status` = 'closed'" is compulsory but here the case is if the where_in or_where_in get succeed it didn't checking the status ,can any plz help me to fix this issue
#2

[eluser]toopay[/eluser]
First, please wrap your code with proper tags
Code:
// remove any space
[ code]<-YourCodeHere->[ /code]




Theme © iAndrew 2016 - Forum software by © MyBB