Re: mysql_affected_rows
| From: | Gabor Hojtsy | Date: | Tue, 26 Oct 2004 15:46:23 +0000 |
| Subject: | Re: mysql_affected_rows | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969364651@lists.php.net to get a copy of this message | ||
Hi Gabriel,
Please submit your suggestions as Documentation bug reports at http://bugs.php.net/, so we can follow its progress.
Goba
Gabriel PREDA írta:
Something odd in manual that stroke me a long time ago ! __1.__ <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 work... and willact 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 withmysql_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 ! Gabriel PREDA www.amr.ro