Codeigniter:计算用户值的列

编程入门 行业动态 更新时间:2024-10-22 21:23:48
本文介绍了Codeigniter:计算用户值的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何获取('user_id',$ id)...?列的计数。

How do I get a count of columns where('user_id', $id)...?

推荐答案

strong>对于行计数

For Row Counts

$this->db->where('user_id', $id); $this->db->from('myTable'); $cnt = $this->db->count_all_results();

有关更多详细信息,请参阅ActiveRecord上的CodeIgniter文档

For more details please see the CodeIgniter Documentation on ActiveRecord

这里

对于Colunm计数

$query = $this->db->where('user_id', $id)->get('myTable'); $cnt = $query->num_fields();

有关详细信息,请参阅CodeIgniter数据库查询结果文档

For more details please see the CodeIgniter Documentation on Database Query Results

这里

更多推荐

Codeigniter:计算用户值的列

本文发布于:2023-10-28 19:33:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1537579.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:用户   Codeigniter

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!