php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #55059 Working of mysql_affected_rows() after SELECT
Submitted: 2011-06-29 00:11 UTC Modified: 2011-07-01 18:57 UTC
From: torbasow at mail dot ru Assigned:
Status: Wont fix Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: torbasow at mail dot ru
New email:
PHP Version: OS:

 

 [2011-06-29 00:11 UTC] torbasow at mail dot ru
Description:
------------
---
From manual page: http://www.php.net/function.mysql-affected-rows%23Description
---
There are nothing about calling mysql_affected_rows() after SELECT. It is logical that it would return 0 because the number of affected rows is zero or the number of affected rows by previous query.

However in practice it returns the number of rows returned by a SELECT! For it is said in MySQL manual that "For SELECT statements, mysql_affected_rows() works like mysql_num_rows()" (http://dev.mysql.com/doc/refman/5.0/es/mysql-affected-rows.html).

This feature should be noted in manual.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-01 18:57 UTC] frozenfire@php.net
-Status: Open +Status: Wont fix
 [2011-07-01 18:57 UTC] frozenfire@php.net
The behaviour of the mysql_affected_rows() function after calling a SELECT is 
unstable, and varies by MySQL server versions, and I think even with PHP 
versions. I don't think we can reasonably document this behaviour in a way that 
would be future-safe or even understandable to most people.

My suggestion would be to not use this function in this way, as the code will be 
highly non-portable.

As such, I'm changing this bug to wont-fix. If you dispute that, please leave a 
comment.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 22:01:28 2024 UTC