DB_common::affectedRows() – Finds number of rows affected by a data changing query


integer affectedRows ( )


Number of rows affected by a data manipulation query (for example INSERT, UPDATE or DELETE). Returns 0 for SELECT queries.

Return value

integer - number of rows or a DB_Error object on failure


Possible PEAR_Error values
Error code Error message Reason Solution
DB_ERROR_NOT_CAPABLE DB backend not capable Function is not supported by the database backend Switch to another database system, if you really need this feature.


This function can not be called statically.


Using affectedRows()

// Once you have a valid DB object named $db...
$res =& $db->query('DELETE * FROM clients');

if (
PEAR::isError($res)) {

'I have deleted ' $db->affectedRows() . ' clients';
Intefejs dostępowy do bazy danych (Previous) Turns auto-commit on or off (Next)
Last updated: Thu, 26 Nov 2015 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

User Notes:

There are no user contributed notes for this page.