If statement to check if post has image

wp_get_attachment_image_src will return false if there is no image. So before you echo the image add if ($image !=false)

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