Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 FuelPHP 新手,我有一个查询问题。所以,这是我的代码:
$query = DB::query('SELECT * FROM `table`'); $result = $query->execute(); $totals = $result->_total_rows; print_r($totals);
而且我不断收到以下错误:致命错误:无法访问受保护的属性 Fuel\Core\Database_MySQL_Result::$_total_rows
如果您只想要查询返回的行数
$query = DB::query('SELECT * FROM `table`'); $result = $query->execute(); // Just count the results, it returns an int. $totals= count($result);
参考手册中的here
或者在您的情况下,当您从表中选择所有并计算它时,您可以使用以下内容
DB::count_records('table');