Foreach only outputs if id is 0

I actually found the issue.

It was in the foreach I found the issue where I had an unnecessary sql-query that i removed.

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