Dear all,
I have below SQL but does not know where is the problem???
//--------------Return all rows, cannot filter by userID-------------------------//
$arr=array("status"=>"Op", "userID"=>$userId);
$farr=array("status"=>"R", "fUserID"=>$userId);
$Inarr=array("status"=>"OC", "userID"=>$userId);
$Outarr=array("status"=>"C", "fUserID"=>$userId);
$this->db->where($arr);
$this->db->or_where($farr);
$this->db->or_where($Inarr);
$this->db->or_where($Outarr);
$query = $this->db->from('message')->where($arr)->or_where($farr)->or_where($Inarr)->or_where($Outarr)->limit($ulimit, $olimit)->get();
//--------Syntax problem------------------------------------------//
$whereSQL=" (status='Op' and userID='".$userId."') or (status='R' and fUserID='".$userId."') ";
$whereSQL=$whereSQL." or (status='OC' and userID='".$userId."') or (status='C' and fUserID='".$userId."') ";
$query=$this->db->from('message')->where($whereSQL)->get();