(Test on MySQL 5.1.36)
Found_rows (): select
Row_count (): update delete insert
Note: It must be used together with the corresponding operation. Otherwise, the returned values are only 1 and-1 (both incorrect values)
Example:
Drop database if exists 'mytest ';
Create database 'mytest ';
Use 'mytest ';
Drop table if exists 'mytesttable ';
Create table 'mytesttable' ('id' int, 'name' varchar (10 ));
Insert into 'mytesttable' ('id', 'name ')
Select '1', 'Role 1' union all
Select '2', 'Role 2' union all
Select '3', 'Role 3 ';
Select row_count (); -- output 3 (returns the number of newly added records). [Note: If insert into... values is used, only 1 is returned.]
Select * from 'mytesttable'; select found_rows (); -- output 3 (return the number of selected rows)
Update 'mytesttable' set 'name' = 'people'; select row_count (); -- output 3 (returns the number of modified rows)
Delete from 'mytesttable'; select row_count (); -- output 3 (return the number of deleted rows)