Exclude posts based on an array

You’re looking for post__in & post__not_in parameters http://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters

Both of them are an array of ID’s for the post’s to include or exclude in the results

BTW in your code, you had a semicolon just after your foreach

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