php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #30579 Incomplete and eroneus reference of mysql_affected_rows
Submitted: 2004-10-27 13:54 UTC Modified: 2004-10-28 10:41 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: gabriel dot preda at amr dot ro Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Not applicable
Private report: No CVE-ID: None
 [2004-10-27 13:54 UTC] gabriel dot preda at amr dot ro
Description:
------------
<para><function>mysql_affected_rows</function> does not work with SELECT statements; only on statements which modify records. To retrieve the number of rows returned by a SELECT, use <function>mysql_num_rows</function>.</para>
     Why... this is not TRUE...
     Called after a SELECT query mysql_affected_rows will asta work... and will act just as mysql_num_rows because PHP's mysql_query calls, by default, MySQL's mysql_store_result.
     If and only if the previous SELECT query was sent with mysql_unbuffered_query witch will not call MySQL's mysql_store_result... mysql_affected_rows will return -1 as if an error ocured.

 __2.__
 There is not mentioned that if the previous query was REPLACE... mysql_affected_rows will return doubled results... that is because MySQL will DELETE and INSERT rows... thus making 2 operations...
 
 All this things are also documented in MySQL Reference Manual whitch is a good source for info about mysql functions present in MySQL extension of PHP... not to mention the MySQLi extension.... !
 
 I believe that the above should be included in this functions' documentation !


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-28 10:41 UTC] vrana@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.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Mar 04 20:00:01 2026 UTC