Which PHP function is used to give the number of rows affected by MySQL query?

MySQLMySQLi DatabasePHP

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
raja
Published on 22-Feb-2018 11:33:36
Advertisements