$this->db->limit($limit);
$query = $this->db->get('your_table');
return $query->result();
$this->db->limit($limit);
- Sets the limit for the number of rows to retrieve in the database query. Replace $limit
with the desired number of rows to be retrieved.
$query = $this->db->get('your_table');
- Executes the query on the specified table ('your_table') using the set limit and retrieves the data accordingly.
return $query->result();
- Returns the result set obtained from the executed query, limited to the specified number of rows.