The fix from PR #4548 doesn't work as expected because in phpBB the sql_affectedrows() method always returns a count of matched rows instead of affected rows. This commit fixes bug properly. PHPBB3-13757