[英]How can I count the numbers of rows that a phalcon query returned?
我如何計算mysql查詢返回的行數? 使用PHP Phalcon Framework ..
我的查詢
$result = $connection->query("SELECT * FROM robots ORDER BY name");
$result = $connection->query("SELECT * FROM robots ORDER BY name");
$result->setFetchMode(Phalcon\Db::FETCH_NUM);
請參閱: http : //docs.phalconphp.com/en/latest/api/Phalcon_Db.html
echo $result->numRows();
print_r($result->fetchAll());
計算結果集的替代方法
$result->count();
要么
count($result);
嘗試
$result = $connection->query("SELECT * FROM robots ORDER BY name");
echo $result->numRows();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.