CodeIgniter: How to use WHERE clause and OR clause

前端 未结 6 1023
误落风尘
误落风尘 2021-01-03 19:23

I am using the following code to select from a MySQL database with a Code Igniter webapp:

$query = $this->db->get_where(\'mytable\',array(\'id\'=>10         


        
6条回答
  •  我在风中等你
    2021-01-03 20:15

    You can use or_where() for that - example from the CI docs:

    $this->db->where('name !=', $name);
    
    $this->db->or_where('id >', $id); 
    
    // Produces: WHERE name != 'Joe' OR id > 50
    

提交回复
热议问题