本文介绍了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:计算用户值的列
发布评论