I am just newbie to the MySQL
.I want to know what is the main differences in between mysql num rows
and mysql affected num rows
?Any example or references will be highly appreciable.
Mysql – Difference in between MySQL affected num rows and num rows
MySQL
Related Question
- Mysql – Joins in MySQL database
- Mysql – the performance difference between IN (42) and id = 42 in MySQL
- MySQL – Difference Between On Delete Cascade & On Update Cascade
- Mysql – 9000 rows affected message, but no rows actually changed
- MySQL – How to Show Differences Between Two Tables
- Mysql – How to select the rows affected by an update
Best Answer
Here's mysql_num_rows:
And here's mysql_affected_rows:
Notice that the input types are different: the first wants a result set, from which it counts the number of rows returned; the second wants a db handle. That makes sense, though, because when you
INSERT
(orUPDATE
,DELETE
,REPLACE
) a row, you typically don't want a result set -- you just want to know if it succeeded or failed, or how many rows it updated/replaced/deleted.