Check if password protected post is visible

post_password_required(): whether post requires password and correct password has been provided.

<?php
if ( post_password_required() ) {
     echo 'xxx';
} else {
     echo 'zzz';
}

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