Рекурсивный акроним словосочетания «PHP: Hypertext Preprocessor»
Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 17142 программиста и 1835 роботов. Сейчас ищут 1575 программистов ...
DB_common::affectedRows()
Вернуться к: DB
DB_common::affectedRows()
DB_common::affectedRows() – Finds number of rows affected by a data changing query
Synopsis
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
Throws
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. |
Note
This function can not be called statically.
Example
Using affectedRows()
<?php
// Once you have a valid DB object named $db...
$res =& $db->query('DELETE * FROM clients');
if (PEAR::isError($res)) {
die($res->getMessage());
}
echo 'I have deleted ' . $db->affectedRows() . ' clients';
?>
Вернуться к: DB