Adding featured image via PHP

Use the set_post_thumbnail function.

set_post_thumbnail( $post_ID, $thumbnail_id );

Require you use WordPress 3.1.0 or later.

You need call this function after you have successfully created your post via wp_insert_post and have a valid $post_ID.

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