php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #50650 mysql_matched_rows
Submitted: 2010-01-04 12:02 UTC Modified: 2010-03-10 22:42 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: robert_xp at gmx dot net Assigned:
Status: Wont fix Package: MySQL related
PHP Version: 5.3.1 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: robert_xp at gmx dot net
New email:
PHP Version: OS:

 

 [2010-01-04 12:02 UTC] robert_xp at gmx dot net
Description:
------------
Sometimes, it is necessary to get the number of matches instead of the number of affected rows. Matches means for example in an UPDATE, where no changes were made (0) there could be some matches. There are two possebilities for that case: an own mysqli_info() parser or a new single count query. http://www.xarg.org/2009/12/php-hacking/

Reproduce code:
---------------
$res = mysqli_query($h, 'UPDATE something ...');
echo mysql_matched_rows($h);
echo mysql_affected_rows($h);

Expected result:
----------------
1
0

// if there is one row, that has the same value as we want to update

Actual result:
--------------
-

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-04 12:46 UTC] uw@php.net
What's the point in coding something that can easily be done in the user space and expanding an outdated API?
 [2010-03-10 22:42 UTC] jani@php.net
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 [2010-03-10 22:42 UTC] jani@php.net
Not everything needs a function in PHP.
 [2010-03-10 22:42 UTC] jani@php.net
-Package: *General Issues +Package: MySQL related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 01:01:31 2024 UTC