How to calculate posts number? [closed]

Do you mean like this

$result = 10;

foreach ( $posts as $post ) {
    if ( $a = $b ) ) {
        $result += 1;
    } else {
        $result -= 2;
    }
}

echo 'Your result is ' . $result;

This is the best I can do with the provided information

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)