1.

Which one of the following method is used to retrieve the number of rows affected by an INSERT, UPDATE, or DELETE query?(a) num_rows()(b) affected_rows()(c) changed_rows()(d) mysqli_affected_rows()This question was posed to me in my homework.I want to ask this question from Working with Databases-2 in portion Objects and Databases in PHP of PHP

Answer»

The correct option is (d) mysqli_affected_rows()

Easy explanation: The method mysqli_num_rows() is only useful for determining the number of ROWS RETRIEVED by a SELECT QUERY. But to retrieve the number of rows affected by INSERT, UPDATE, or DELETE query, use mysqli_affected_rows(). Num_rows() andaffected_rows() were used in previous version of PHP.



Discussion

No Comment Found

Related InterviewSolutions