選擇資料

選擇條件資料

$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();