php - Codeigniter how to use get_where/or_where together to return a result_array -
i trying result_array()
database 2 columns must return true, , vise-versa decided use or_where
code returning call undefined method ci_db_mysqli_result::or_where()
error, advice how can achieve this?
i using below code on inside ci_model.
public function check_request($userid, $senderid){ $query = $this->db->get_where('connection',array('user_id' => $userid, 'sender_id' => $senderid)); $query = $this->db->or_where('connection',array('sender_id' => $userid, 'user_id' => $senderid)); return $query->result_array(); }
try below:
public function check_request($userid, $senderid){ $this->db->select('*'); $this->db->where("(user_id = '$userid' , sender_id = '$senderid') or (sender_id='$userid' , user_id = '$senderid')"); $query = $this->db->get('connection'); return $query->result_array(); }
Comments
Post a Comment