Fix BaseBuilder setAlias() and RawSql use with key value pairs by @sclubricants in #6741 fix: BasePreparedQuery class to return boolean values for write-type queries by @michalsn in #6750 fix: Time::now() does not respect timezone when using setTestNow() by @kenjis in #6752 fix: ...
这种方式实现有个缺点,加入我做了一个应用放在Application下,同时为这个应用做了一个后台放在Admin文件夹...
$query=$this->db->get()->result_array(); //直接写sql $sql="SELECT * FROM category WHERE is_show = ? "; $query=$this->db->query($sql,array(1)); echo$query->result_id; var_dump($query); return$query->result_array(); //技巧: // //表数据//返回一个包含当前连接数据库中所...
$this->db->join('activity','activity.id = personal_record.activity'); $this->db->where('activity.delete_time',null); $this->db->or_where('personal_record.confirm_time !=',null); $this->db->order_by('time','asc'); $this->db->group_by('user.id'); $data=...
$where = "author_id = 1 AND status = 'active'"; $str = $this->db->update_string('table_name', $data, $where); The first parameter is the table name, the second is an associative array with the data to be updated, and the third parameter is the "where" clause. The above exam...
return $this->db->query(" SELECT * FROM myTable WHERE trans_id IN ( SELECT trans_id FROM myTable WHERE code='B') AND code!='B' ")->result_array(); Is not active record but is codeigniter's way http://codeigniter.com/user_guide/database/examples.html see Standard Query With Mu...
The second parameter enables you to set whether or not the query builder query will be reset (by default it will be reset, just like when using $this->db->get()):echo $this->db->limit(10,20)->get_compiled_select('mytable', FALSE); // Prints string: SELECT * FROM mytable LIMIT...
$where = "author_id = 1 AND status = 'active'"; $str = $this->db->update_string('table_name', $data, $where); The first parameter is the table name, the second is an associative array with the data to be updated, and the third parameter is the "where" clause. The above exam...
$query = $this->db->query("SELECT * FROM mytable"); // Turn caching off for this one query $this->db->cache_off(); $query = $this->db->query("SELECT * FROM members WHERE member_id = '$current_user'"); // Turn caching back on ...
Simple key/value method: $this->db->like('title', 'match'); // Produces: WHERE title LIKE '%match%' If you use multiple function calls they will be chained together with AND between them: $this->db->like('title', 'match'); $this->db->like('body', 'match'); // WHERE ...