[eluser]mihaibaboi[/eluser]
From what can I see, I'm guessing that you skiped a step. You loop through the array, but you don't treat each item as an object. Remember that in the foreach, your item is a stdClass object, and you should treat it as such.
But that's just a wild guess. Please provide the foreach code so we can better understand the problem.