Number of unpublished comments for each post

I wonder if you’re looking for the wp_count_comments() function.

To retreive comment count statistics for the whole site, you can use:

$comments_count = wp_count_comments();

or for a given post ID:

$comments_count = wp_count_comments( 123 );

It will return an object with the following attributes:

$comments_count->moderated 
$comments_count->approved 
$comments_count->spam
$comments_count->trash 
$comments_count->total_comments 

Check the Codex for more information and examples.

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