**CI两种方式查询所返回的结果数量
生活随笔
收集整理的這篇文章主要介紹了
**CI两种方式查询所返回的结果数量
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
區別:第一個是有條件的;第二個沒有條件
$this->db->count_all_results();
允許你獲得某個特定的Active Record查詢所返回的結果數量。可以使用Active Record限制函數,例如 where(), or_where(), like(), or_like() 等等。范例:
echo $this->db->count_all_results('my_table');
// 生成一個整數,例如 25
$this->db->like('title', 'match');
$this->db->from('my_table');
echo $this->db->count_all_results();
// 生成一個整數,例如 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:
計算出指定表的總行數并返回。在第一個參數中寫入被提交的表名。例如: echo $this->db->count_all('my_table');
// Produces an integer, like 25?
總結
以上是生活随笔為你收集整理的**CI两种方式查询所返回的结果数量的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 戒烟成功
- 下一篇: SHELL中的while与unil流程控