From: gabriel dot preda at amr dot ro
Operating system: Not applicable
PHP version: Irrelevant
PHP Bug Type: Documentation problem
Bug description: Incomplete and eroneus reference of mysql_affected_rows
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 !
--
Edit bug report at http://bugs.php.net/?id=30579&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30579&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30579&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30579&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30579&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30579&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30579&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30579&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30579&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30579&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30579&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30579&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30579&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30579&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30579&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30579&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30579&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30579&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30579&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30579&r=mysqlcfg