|  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
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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
26 - 21 = ?
Subscribe to this entry?

 [2010-01-04 12:02 UTC] robert_xp at gmx dot net
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.

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

Expected result:

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

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-04 12:46 UTC]
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]
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 [2010-03-10 22:42 UTC]
Not everything needs a function in PHP.
 [2010-03-10 22:42 UTC]
-Package: *General Issues +Package: MySQL related
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Dec 04 21:03:34 2021 UTC