This MySQL function returns the number of rows changed by the previous SQL statement.
Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).
This function returns the number of rows changed by the previous SQL statement. If the previous statement was not one that could potentially change data rows—in other words, it wasn't an INSERT, UPDATE, DELETE, or other such statement— this function will return -1.
SELECT ROW_COUNT(); +-------------+ | ROW_COUNT() | +-------------+ | 4 | +-------------+
The results here show that four rows were changed.