Determining Author post count

This thread on the wordpress codex shows how you can scope your SQL query:

$author_post_count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author="" . $$username->ID . "" AND post_type="post" AND post_status="publish"");

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