Bug #23021 The documentation for mysql_stmt_num_rows() is incomplete.
Submitted: 5 Oct 2006 17:09 Modified: 5 Oct 2006 17:47
Reporter: emerson clarke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version: OS:
Assigned to: Paul DuBois CPU Architecture:Any
Tags: affected, documentation, num, prepared, rows, statements

[5 Oct 2006 17:09] emerson clarke
Description:
http://dev.mysql.com/doc/refman/5.0/en/mysql-stmt-num-rows.html

The documentation for the mysql_num_rows() function does not fully describe its behavior.  In particular, it neglects to point out that the mysql_num_rows() function will return 0 for any query that is not a select statement.

In most cases, users will want to use mysql_affected_rows() so that they get the number of affected rows for insert, update, and delete statements.

Whilst the documentation on mysql_affected_rows() indicates the behavior of mysql_num_rows(), the documentation for mysql_num_rows() itself is lacking this vital information.

How to repeat:
Read the documentation.

http://dev.mysql.com/doc/refman/5.0/en/mysql-stmt-num-rows.html

Suggested fix:
Ammend the documentation for mysql_num_rows() to explain that it will return 0 for insert,update, and delete statements and suggest a link to mysql_affected_rows() for most purposes.
[5 Oct 2006 17:47] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.

I modified the descriptions or mysql_num_rows() and mysql_stmt_num_rows()
to point out that they're for SELECT and the affected-rows functions should be
used otherwise.