Model::count
条件に合う行の数を取得します
説明
public int Model::count()
条件に合う行の数を返します。groupやhavingを使っている場合は、グループの数を返します。orderとlimitは無視します。
例
Controller
$model = new Model(false, array(
'table' => 'cms_news',
'id' => 'news_id',
'visible' => 'visible',
));
$count = $model->count();
// -> 23
$count = $model->where('category = ?', 2)->count();
// -> 7
// Number of categories
$count = $model->group('category')->count();
// -> 3