Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference in between mysql_num_rows and mysql_affected_rows

I want to know what is the difference in between mysql_num_rows and mysql_affected_rows.How to know when it should use.Any help and suggestions will be highly appreciable.Examples are most welcome.

like image 498
NewUser Avatar asked Mar 08 '12 12:03

NewUser


Video Answer


1 Answers

Use mysql_num_rows for SELECT queries while mysql_affected_rows for UPDATE and DELETE queries.

  • mysql_num_rows tells you how many records were returned from a SELECT query
  • mysql_affected_rows tells you how many rows were UPDATEed or DELETEed
like image 144
Sarfraz Avatar answered Oct 02 '22 16:10

Sarfraz