Codeigniter运行mysql查询和返回行的echo数

Mic*_*sby 3 php mysql codeigniter

<?=$this->db->count_all_results('users')?>
Run Code Online (Sandbox Code Playgroud)

嗨,我被困在某事上.如何运行如下所示的查询计数并回显所有返回的行?我目前正在使用上述声明,但我需要这种改进.

<?php $aa = $this->db->query("SELECT * FROM users WHERE itemNumber = 1");
Run Code Online (Sandbox Code Playgroud)

Rag*_*jal 8

使用num_rows()方法

<?php
 $aa = $this->db->query("SELECT * FROM users WHERE itemNumber = 1");
echo $aa->num_rows();

?>
Run Code Online (Sandbox Code Playgroud)