PHP Function to Get Number of Affected Rows by MySQL Query



PHP uses mysql_affected_rows( ) function to find out how many rows a query changed. This function basically returns the number of affected rows in the previous SELECT, INSERT, UPDATE, REPLACE, or DELETE query. Return of an integer > 0 indicates the number of rows affected, 0 indicates that no records were affected and -1 indicates that the query returned an error. Its syntax is as follows −

Syntax

mysql_affected_rows( connection );

Followings are the parameters used in this function −

S. No.
Parameter & Description
1.
Connection
Required – Specifies the MySQL connection to use
Updated on: 2020-06-22T14:08:04+05:30

205 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements