Update if post with specific title exists

First, I would use WP_Query instead of the manual DB query (and don’t tell me that’s because of performance because you’re querying 2 times the same thing). Second, you’re saving your post as draft status and querying post with status publish

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