Updating post_parent by id (many times)

A post can only ever have one parent post.

I’m certain you can still accomplish what you want using post meta, though. If you give us a better explanation of what you’re trying to do we might be able to help.

For example,

function updating_parent() {
    // your code to get posts

    foreach ( $my_posts as $post ) {
        update_post_meta( $post->ID, 'related_posts', array( 12, 23, 42 ) );
    }
}

Then you can access this data using get_post_meta:

$related_posts = get_post_meta( get_the_ID(), 'related_posts', true );

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