CodeIgniter Active Record - 获取返回的行数 [英] CodeIgniter Active Record - Get number of returned rows

查看:207
本文介绍了CodeIgniter Active Record - 获取返回的行数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是CodeIgniter和Active Record的新手,特别是我知道如何在正常的SQL中做到这一点,但我想学习。

I'm very new to CodeIgniter and Active Record in particular, I know how to do this well in normal SQL but I'm trying to learn.

我可以从我的表中选择一些数据,然后计数使用CodeIgniters Active Record类返回多少行?

How can I select some data from one of my tables, and then count how many rows are returned using CodeIgniters Active Record class?

谢谢,
汤姆。 p>

Thanks, Tom.

推荐答案

查看结果函数此处

$this->db->from('yourtable');
[... more active record code ...]
$query = $this->db->get();
$rowcount = $query->num_rows();

这篇关于CodeIgniter Active Record - 获取返回的行数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆