I suppose that affected_rows returns the number of affected rows in the last query (for example an UPDATE) and num_rows the number of the rows in a result set (for example a SELECT).
What should I use in PDO?
PDOStatement::rowCount returns the number of rows affected in that statement but for most databases does not return the number of rows affected by a SELECT.