版本: v2.3.0
count
統計資料表中符合條件的記錄數。
count($table, $where)
table [string]
要查詢的資料表名稱。
where [array] (可選)
用於篩選待統計記錄的 WHERE 條件。
count($table, $join, $column, $where)
table [string]
要查詢的資料表名稱。
join [array]
用於關聯相關資料表的 JOIN 定義;如果不需要 JOIN,可省略此參數。
column [string]
要統計的欄位。
where [array] (可選)
用於篩選待統計記錄的 WHERE 條件。
回傳值
[int] 回傳符合條件的記錄數。
此方法一律回傳整數。
$count = $database->count("account", [
"gender" => "female"
]);
echo "共有 {$count} 位女性使用者。";