码迷,mamicode.com
首页 > 其他好文 > 详细

**两种方式查询所返回的结果数量

时间:2015-05-22 15:02:31      阅读:137      评论:0      收藏:0      [点我收藏+]

标签:

区别:第一个是有条件的;第二个没有条件

$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 

**两种方式查询所返回的结果数量

标签:

原文地址:http://www.cnblogs.com/kenshinobiy/p/4522150.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!