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.