选择数据

选择条件数据

$query  = $this->db->select('*')
                   ->from('table_name')
                   ->where('column_name', $value) // Condition 
                   ->get();
return $query->result();

选择具有多个条件的数据

$conditions = array('column_name_1' => $value_1, 'column_name_2' => $value_2);
$query  = $this->db->select('*')
                   ->from('table_name')
                   ->where($conditions) // Conditions
                   ->get();
return $query->result();

选择具有条件和限制的数据

$query  = $this->db->select('*')
                   ->from('table_name')
                   ->where('column_name', $value) // Condition
                   ->limit(10) // Maximum 10 rows
                   ->get();
return $query->result();

选择条件,最大行数和降序的数据

$query  = $this->db->select('*')
                   ->from('table_name')
                   ->where('column_name', $value) // Condition
                   ->limit(10) // Maximum 10 rows 
                   ->order_by('id','DESC') // Order data descending 
                   ->get();
return $query->result();