codeigniter v4 num_rows() 调用未定义的方法 [英] codeigniter v4 num_rows() Call to undefined method
本文介绍了codeigniter v4 num_rows() 调用未定义的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
未在文档 Codeigniter 4 中找到的行数.
Num rows not found in the documentation Codeigniter 4.
我的模型中的方法:
public function getListCat()
{
$listCat = $this->asArray()->where(['id_user' => $session->id])->get();
return $listCat->num_rows();
我检查了调用未定义的方法 CodeIgniter\Database\MySQLi\Result::num_rows()"
i check "Call to undefined method CodeIgniter\Database\MySQLi\Result::num_rows()"
如何在 Codeigniter 4 中获取num_rows()"数据?
How i can get "num_rows()" data in Codeigniter 4?
推荐答案
Codeigniter 4 没有 num_row() 函数,就像 codeigniter 3 一样.这是我检查数据是否存在的方式.我正在尝试重新修改下面的代码
Codeigniter 4 doesn't have num_row() function just like codeigniter 3. This is how I check if any data exists. I am trying to re-modify your code below
public function getListCat()
{
$listCat = $this->asArray()->where('id_user', $session->id)->countResultAll();
return $listCat;
}
我希望这对你有用,否则请引起我的注意.
I hope this will work for you else call my attention.
这篇关于codeigniter v4 num_rows() 调用未定义的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文