How to write a foreach that will produce the results I want
<p>I am having a hard time getting the correct data out of an array. I wrote a nested foreach loop but the inner loop is throwing the "Invalid argument supplied for foreach()" error. Can someone please help me out with this? Thanks.</p>

<pre><code>foreach($row as $val)
{
    echo $val['title'].'&lt;br&gt;';
    echo $val['author'].'&lt;br&gt;';
    echo $val['post'].'&lt;br&gt;';
    echo $val['entry_date'].'&lt;br&gt;';
    echo $val['comments'].'&lt;br&gt;';

    foreach($val as $val2)
    {
        echo $val['comments'].'&lt;br&gt;';
    }
}
</code></pre>

<p><hr /></p>

<pre><code>Array
(
    [title] =&gt; First Blog
    [author] =&gt; Administrator
    [post] =&gt; Testing entry number one
    [entry_date] =&gt; Fri, 23 Oct 2009
    [comments] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [commenter] =&gt; Sally Anderson
                    [comments] =&gt; comment 1 post 1
                    [comment_date] =&gt; October 24th, 2009 at 5:24 AM
                )

            [1] =&gt; Array
                (
                    [commenter] =&gt; Mike Jones
                    [comments] =&gt; comment 2 post 1
                    [comment_date] =&gt; October 24th, 2009 at 5:21 AM
                )
        )
)
Array
(
    [title] =&gt; Second Blog
    [author] =&gt; Administrator
    [post] =&gt; Testing entry number two
    [entry_date] =&gt; Sat, 24 Oct 2009
    [comments] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [commenter] =&gt; Sally Anderson
                    [comments] =&gt; comment 1 post 2
                    [comment_date] =&gt; October 24th, 2009 at 5:21 AM
                )

            [1] =&gt; Array
                (
                    [commenter] =&gt; Mike Jones
                    [comments] =&gt; comment 2 post 2
                    [comment_date] =&gt; October 24th, 2009 at 5:21 AM
                )
        )
)
</code></pre>
