$data = $query->result();
$data = $query->result_array();
$data = $query->row();
$data = $query->num_rows();
$data = $query->num_fields();
$data = $query->row_array();
$data = $query->free_result();
echo
$this->db
->insert_id();
echo
$this->db
->affected_rows();
echo
$this->db
->count_all(
'table_name');
echo
$this->db
->version();
echo
$this->db
->platform();
echo
$this->db
->last_query();
$this->db
->insert_string(
'table_name',
$data);
$this->db
->update_string(
'table_name',
$data,
$where);
$this->db
->get(
'table_name');
$this->db
->get(
'table_name',
10,
20);
$this->db
->get_where(
'table_name',
array(
'id'=>$id),
$offset);
$this->db
->select(
'title, content, date');
$data = $this->db
->get(
'table_name');
$this->db
->select_max(
'age');
$this->db
->select_max(
'age',
'nianling');
$this->db
->select_min(
'age');
$this->db
->select_min(
'age',
'nianling');
$this->db
->select_sum(
'age');
$this->db
->select_sum(
'age',
'nianling');
$this->db
->select(
'title', content,
date');
$this->db->from('table_name
');
//查询条件 WHERE name = 'Joe
' AND title = 'boss
' AND status = 'active
'
$this->db->where('name
', $name);
$this->db->where('title
', $title);
$this->db->where('status
', $status);
//范围查询
$this->db->where_in('item1
', 'item2
');
$this->db->where_not_in('item1
', 'item2
');
//匹配,第三个参数为匹配模式 title LIKE '%match%'
$this->db->like('title
', 'match', 'before/after/both
');
$this->db->not_like();
//分组 GROUP BY title, date
$this->db->group_by('title
', 'date');
//限制条数
$this->db->limit(0, 20);
//这个函数会检测数据类型,仅转义字符串类型的数据。 它会自动用单引号将你的数据括起来,你不用手动添加。
$this->db->escape();
For example:
>$sql="insert into table(title)values(".$this->db ->escape($title).")";
转载请注明原文地址: https://www.6miu.com/read-22941.html