SQL如下
select * from `users` where create_time >= '2020-06-01 00:00:00'
使用 rowCount() 方法是错误的,rowCount() 返回的是受影响行数。正确的做法是使用相同的条件放到 select count(*) 语句中。
select count(*) from `users` where create_time >= '2020-06-01 00:00:00'
然后通过 fetchColumn 查询
$totalCount = $pdo->query("select count(*) from `users` where {$sqlWhere}")->fetchColumn();