Definition

db_affected_rows()
drupal/includes/database/database.inc, line 2365

Description

Determine the number of rows changed by the preceding query.

This may not work, actually, without some tricky temp code.

@todo Remove this function when all queries have been ported to db_update().

Related topics

Namesort iconDescription
Database abstraction layerAllow the use of different database servers using the same code base.

Code

function db_affected_rows() {
  $statement = Database::getActiveConnection()->lastStatement;
  if (!$statement) {
    return 0;
  }
  return $statement->rowCount();
}