Home > Article > Backend Development > Which PHP function is used to get the number of rows affected by a MySQL query?
PHP uses the mysql_affected_rows( ) function to find out how many rows were changed by the query. This function basically returns the number of rows affected in a previous SELECT, INSERT, UPDATE, REPLACE, or DELETE query. Returns an integer > 0 indicating the number of rows affected, 0 indicating that no records were affected, and -1 indicating that the query returned an error. Its syntax is as follows -
mysql_affected_rows( connection );
The following are the parameters used in the function -
S. No. | Parameters and description |
---|---|
ConnectionRequired – Specifies the MySQL connection to use |
The above is the detailed content of Which PHP function is used to get the number of rows affected by a MySQL query?. For more information, please follow other related articles on the PHP Chinese website!