Bladephp: Now with 8+ codeigniter, php, and laravel project 8+ php project From $37/Month From Rs. 2499/Month

count_all_results() Query in Codeigniter

by
Category:codeigniter
codeigniter mysql
count_all_results() Query in Codeigniter

The count_all_results() method is used to get the number of rows in a MySQL result handle.

Permits you to determine the number of rows in a particular Active Record query. Queries will accept Query Builder restrictors such as where(), or_where(), like(), or_like(), etc.

echo $this->db->count_all_results('my_table'); 
// Produces an integer, like 25

More Example

$this->db->like('category', 'php');
$this->db->from('tbl_post');
echo $this->db->count_all_results(); 
// Produces an integer, like 17

count_all_results() method also resets any field values that you may have passed to select(). If you need to keep them, you can pass FALSE as the second parameter.

echo $this->db->count_all_results('tbl_user', FALSE);

0 Comments


Html code work in comment box


Related Post