note 128196 added to mysqli.affected-rows
| From: | lucgommans dot nl at main dot php dot net | Date: | Tue, 07 Feb 2023 15:02:08 +0000 |
| Subject: | note 128196 added to mysqli.affected-rows | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220153@lists.php.net to get a copy of this message | ||
Under the hood, this calls into mysql_affected_rows (1). The MariaDB function ROW_COUNT() mentions
(2) that it is the equivalent of that C API function. These two lines, SQL followed by PHP, should
be equivalent:
SELECT ROW_COUNT();
$db->affected_rows;
I found this useful to double check things in an SQL prompt, to make sure affected_rows is
reflecting what I expect (changed rows as opposed to matched rows in an update statement), which
indeed it did.
1. https://github.com/php/php-src/blob/1521cafee29e23ca147ec777f3770a7ac46c6880/ext/mysqli/mysqli_api.c#L36-L49
2. https://mariadb.com/kb/en/row_count/
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.13.130 (proxied: 78.48.191.253)
----
Manual Page -- https://php.net/manual/en/mysqli.affected-rows.php
Edit -- https://main.php.net/note/edit/128196
Del: integrated -- https://main.php.net/note/delete/128196/integrated
Del: useless -- https://main.php.net/note/delete/128196/useless
Del: bad code -- https://main.php.net/note/delete/128196/bad+code
Del: spam -- https://main.php.net/note/delete/128196/spam
Del: non-english -- https://main.php.net/note/delete/128196/non-english
Del: in docs -- https://main.php.net/note/delete/128196/in+docs
Del: other reasons-- https://main.php.net/note/delete/128196
Reject -- https://main.php.net/note/reject/128196
Search -- https://main.php.net/manage/user-notes.php