В чем разница между mysqli_affected_rows и mysqli_num_rows?

Недавно я искал разницу и обнаружил, что в то время как yes mysqli_num_rows подсчитывает, сколько строк нашел ваш оператор SELECT .

mysqli_affected_rows will count how many rows your UPDATE/INSERT/DELETE/REPLACE and SELECT statement 'affected'.

Unless you are trying to compare between the number of rows returned in a SELECT statement vs. the number of rows affected in an UPDATE/INSERT/DELETE/REPLACE than there is no huge concern over which you need to be using. If you want to be semantically correct than use the appropriate one for the corresponding statement.

https://dev.mysql.com/doc/refman/8.0/en/mysql-affected-rows.html

For SELECT statements, mysql_affected_rows() works like mysql_num_rows()
Теги:
mysqli_affected_rows, mysqli_num_rows
Добавлено: 20 Мая 2021 06:06:19 Добавил: Андрей Ковальчук
Добавить