Limit Query Codeigniter

“Codeigniter Use Limit Query, Limit Query use With Codeigniter,How to Use Limit Query in Codeigniter”

Hello friends, today I will tell you how to use limit queries in the Codeigniter through Expertsphp tutorial.

Friends, you will first want to say that the use of the limit query is used to get the limit data. For example, there are 10 data in your table and you want to get 5 data. So we can get 5 data through the limit query. How to use the limit query You can see below how queries are written in the code code in the codeigniter.

Limit Query

$this->db->from($this->table_name);
$this->db->limit(5);
$query = $this->db->get();
return $query->result();

Limit Query Use With Where

$this->db->from($this->table_name);
$this->db->where("city", "delhi");
$this->db->limit(5);
$query = $this->db->get();
return $query->result();