Which PHP function is used to give the number of rows affected 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: 22-Jun-2020

150 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements