Welcome Guest, Not a member yet? Register   Sign In
Or in a select statement
#1

PHP Code:
function select($table_name$where_data){
            $this->db->select('*');
          $this->db->from($table_name);
          $this->db->where($where_data);
        
$this->db->order_by('id','DESC');
          $query $this->db->get();
        
// echo $str = $this->db->last_query();
          return $query->result();




If I want to do an "or" is this right


$user_data=$this->action->select("table", array("a"=>$a, "b"=>$b) or array("c"=>$c, "b"=>$b));



Thanks
Reply
#2

(This post was last modified: 03-11-2021, 10:18 AM by iRedds.)

Can you show the final SQL query you are expecting?
Reply
#3

something like 

select * from table where ( a = 'aa' and b = 'bb')  or (c = 'aa' and b = 'bb')
Reply
#4

Query grouping
Reply




Theme © iAndrew 2016 - Forum software by © MyBB