Codeigniter's `where` and `or_where`

前端 未结 5 1681
旧时难觅i
旧时难觅i 2020-12-09 03:41

I\'m trying to specify a query in my model

$this->db
        ->select(\'*\')
        ->from(\'library\')
        ->where(\'library.rating >=\'         


        
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-09 04:20

    You can use : Query grouping allows you to create groups of WHERE clauses by enclosing them in parentheses. This will allow you to create queries with complex WHERE clauses. Nested groups are supported. Example:

    $this->db->select('*')->from('my_table')
            ->group_start()
                    ->where('a', 'a')
                    ->or_group_start()
                            ->where('b', 'b')
                            ->where('c', 'c')
                    ->group_end()
            ->group_end()
            ->where('d', 'd')
    ->get();
    

    https://www.codeigniter.com/userguide3/database/query_builder.html#query-grouping

提交回复
热议问题