php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #39072 mysqli_affected_rows has self-conflicting documentation
Submitted: 2006-10-07 00:20 UTC Modified: 2007-01-22 02:48 UTC
From: php_bug at incognitox dot org Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: N/A
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php_bug at incognitox dot org
New email:
PHP Version: OS:

 

 [2006-10-07 00:20 UTC] php_bug at incognitox dot org
Description:
------------
The current documentation in the PHP5 manual for the function mysqli_affected_rows (currently visible online at http://php.net/mysqli_affected_rows) has the following conflicting information:

"For SELECT statements mysqli_affected_rows() works like mysqli_num_rows()."

"The mysqli_affected_rows() function only works with queries which modify a table. In order to return the number of rows from a SELECT query, use the mysqli_num_rows() function instead."

The former appears to actually be the case.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-22 02:48 UTC] didou@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2016-11-18 21:29 UTC] aik dot bold at gmail dot com
For me on PHP 5.4+ (PHP 5.5 and PHP 5.6 including) the "mysqli_affected_rows()" always returns "-1" for "SELECT" queries and only "mysqli_num_rows()" gives correct number.

When I've used "mysql_affected_rows" (no "i") it was working fine with "SELECT" statements as well.

The docs on http://php.net/manual/en/mysqli.affected-rows.php page still looks confusing:

---
Returns the number of rows affected by the last INSERT, UPDATE, REPLACE or DELETE query.

For SELECT statements mysqli_affected_rows() works like mysqli_num_rows().
---
 [2016-11-18 22:11 UTC] aik dot bold at gmail dot com
Looking more into this the issue was the xDebug. When I was debugging call to "mysqli_affected_rows" it always returned "-1". When however I've assigned call to "mysqli_affected_rows" to a variable and debugged next line the result was correct.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 13:00:02 2026 UTC