[eluser]Randy Casburn[/eluser]
Well my first post was just plain dumb. I didn't even see: $result = $query2->row(); that! So you can ignore my first post.
@cjunky -- if you take a second look you'll the code is doing precisely what you prescribe.
@Bl4cKWid0w - (I'm always afraid to answer your posts because of that handle {brrr}) - Your use of variable names confounds things a little $row here and $result there has confused us a little.
For instance, $row from the foreach loop should be treated as an array since the foreach loop construct places the contents of multidimensional arrays into an array and not into an object. So when you are addressing the contents of the foreach array members, you really should address them with array notation and not object notation. This would help.
Randy