problem with has_post_thumpnail in foreach loop

Use this code instead of has_post_thumbnail()

if ( '' != get_the_post_thumbnail() ) {
    // some code
}

Please refer below link for more information

http://codex.wordpress.org/Function_Reference/has_post_thumbnail

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