After updating or deleting or inserting records, we can get the number of rows changed or affected as a result of the query by using rowCount() command.
All source codes and samples are available here
https://www.plus2net.com/php_tutorial...
Update query
We can use the query like this
update pdo_admin set status='T'
By using rowCount() we can get the number of records affected by this query.
Delete query
delete from pdo_admin where status='F'
By using rowCount() we can get the number of records deleted by this query.
rowCount() will not give accurate result while using SELECT query. So it is better to use count() command to get number of records.
rowCount() won’t able to return number of rows affected while using Truncate command.