Check if post exists

WordPress has a post_exists function that returns the post ID or 0 otherwise.
So you can do

if ( 0 === post_exists( $title ) ) {
    **YOUR_CODE_HERE**
}

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