对于某个表的不带条件的count,能够简单的用html
$total = $this->db->count_all($table_name)ide
来获取,可是若是有条件,则要用count_all_resultspost
$this->db->where('sex', 'M');ui
$this->db->from('user');this
$total = $this->db->count_all_results();url
CI的pagination库能够帮助添加分页连接,用法能够看user_guide/libraries/pagination.htmlspa
有几点须要说明。.net
base_url里边若是有超过2个uri_segments,则须要设置$config['uri_segment'] = base_url_segments + 1htm
也就是uri_segment默认是3。若是不设置的话,第一页和前一页,后一页的连接都不正确。blog