R
R
ragnar_ok2021-07-31 12:06:15
1C-Bitrix
ragnar_ok, 2021-07-31 12:06:15

How to get the number of deleted rows?

Bitrix ORM does not provide a method for deleting rows by condition. How to get the number of deleted rows using \Bitrix\Main\DB\Connection::query?

\Bitrix\Main\DB\Result::getSelectedRowsCountreturns null.

$connection = Application::getConnection();

do {
    $query = $connection->query('delete from logs limit 10');
    $numberOfRecordsDeleted = $query->getSelectedRowsCount(); // null
} while ($numberOfRecordsDeleted);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
PetrPo, 2021-07-31
@ragnar_ok

try $connection->getAffectedRowsCount()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question