Replace remaining uses of deprecated db_num_rows() function

The db_num_rows() function is deprecated as some databases do not know how
many rows are being returned until all rows have been requested from the
server. We therefore have to perform the row count ourselves - when
necessary.

In many cases it may make more sense to perform a SELECT(*) query to
retrieve counts. This is less costly than returning data that we're not
going to use. This is something to consider in the future as the core is
upgraded to use more modern/robust database queries.
Do we need to load all users in array then action them?  Why not iterate while deleting one by one, then show error message if we didn't process at least one user?