How to Test a Blog Post for Update vs. Publish Status — Unique

You can make use of dynamic hook

do_action( "{$old_status}_to_{$new_status}", $post );

in wp_transition_post_status() to target exact combination. So in your case it would be something like draft_to_publish.

I am not sure why exactly your attempt is failing though, without thoroughly debugging it.

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