**CI两种方式查询所返回的结果数量
區(qū)別:第一個(gè)是有條件的;第二個(gè)沒有條件
$this->db->count_all_results();
允許你獲得某個(gè)特定的Active Record查詢所返回的結(jié)果數(shù)量??梢允褂肁ctive Record限制函數(shù),例如 where(), or_where(), like(), or_like() 等等。范例:
echo $this->db->count_all_results('my_table');
// 生成一個(gè)整數(shù),例如 25
$this->db->like('title', 'match');
$this->db->from('my_table');
echo $this->db->count_all_results();
// 生成一個(gè)整數(shù),例如 17?
------------------------------------------------------
$this->db->count_all();
Permits you to determine the number of rows in a particular table. Submit the table name in the first parameter. Example:
計(jì)算出指定表的總行數(shù)并返回。在第一個(gè)參數(shù)中寫入被提交的表名。例如: echo $this->db->count_all('my_table');
// Produces an integer, like 25?
總結(jié)
以上是生活随笔為你收集整理的**CI两种方式查询所返回的结果数量的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 戒烟成功
- 下一篇: SHELL中的while与unil流程控