pull custom fields values from wp-database in a nested foreach loop

Technically, you should use WP’s built-in class WP_Query to pull the information and I am sure that will alone simplify your entire process.

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