欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

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

发布时间:2025/7/14 53 豆豆
生活随笔 收集整理的这篇文章主要介绍了 **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 

如何联系我:【万里虎】www.bravetiger.cn 【QQ】3396726884 (咨询问题100元起,帮助解决问题500元起) 【博客】http://www.cnblogs.com/kenshinobiy/

总结

以上是生活随笔为你收集整理的**CI两种方式查询所返回的结果数量的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。