Codeigniter's `where` and `or_where`

前端 未结 5 1680
旧时难觅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:12

    You can modify just the two lines:

    ->where('(library.available_until >=', date("Y-m-d H:i:s"), FALSE)
    ->or_where("library.available_until = '00-00-00 00:00:00')", NULL, FALSE)
    

    EDIT:

    Omitting the FALSE parameter would have placed the backticks before the brackets and make them a part of the table name/value, making the query unusable.

    The NULL parameter is there just because the function requires the second parameter to be a value, and since we don't have one, we send NULL.

提交回复
热议问题