php中CI框架中查询关联数组方法

时间:2016-10-22 11:35:55 类型:PHP
字号:    


phpCI框架中多条件查询数据时,可使用以下方法:
 $array = array('id' => $id, 'title' => $title, 'content' => $content);

    $this->db->where($array);

    // Produces: WHERE id= '1' AND title = 'http://www.lhqing.com' AND content= 'www.lhqing.com'

    //或者你也可以在这个方法里包含你自己的比较运算符:

    $array = array('id>1' => $id, 'title !=' => $title, 'content' => $content);

    $this->db->where($array);
?>