更新时间:2023-02-26 12:05:12
如果要计算行数,可以使用PDO做到这一点:
If you want to count the rows you can do this with PDO:
$sql = 'select * from users';
$data = $conn->query($sql);
$rows = $data->fetchAll();
$num_rows = count($rows);
在PDO中使用SELECT
语句时,无法直接对行进行计数.
There is no way to directly count rows when using a SELECT
statement with PDO.