PHP error question
<p>I keep getting the following error below. How can I correct this error?</p>

<pre><code>Warning: Invalid argument supplied for foreach() on line 25.
</code></pre>

<p>Line 25 is.</p>

<pre><code>foreach ($parent_comment_id as $id =&gt; $comment) {
</code></pre>

<p>Here is the PHP &amp; MySQL code.</p>

<pre><code>function make_comments($parent_comment_id = 0, $comment_id = 0) {
global $user_id;
global $comment_order;

foreach ($parent_comment_id as $id =&gt; $comment) {

    if($comment['user_id'] == $user_id &amp;&amp; $comment['parent_comment_id'] == 0){
        $comment_id = $comment['comment_id'];
        echo '&lt;div&gt;' . $comment['comment'] . '&lt;/div&gt;';

        if($comment_id  == $comment['parent_comment_id']){
            if($comment['user_id'] == $user_id &amp;&amp; $comment['parent_comment_id'] &gt;= 1) {
                $comment_id = $comment['comment_id'];
                echo '&lt;div&gt;' . $comment['comment'] . '&lt;/div&gt;';
            } else if($comment['parent_comment_id'] &gt;= 1) {
                $comment_id = $comment['comment_id'];
                echo '&lt;div&gt;' . $comment['comment'] . '&lt;/div&gt;';
            }
        }           

    } else if($comment['user_id'] != $user_id &amp;&amp; $comment['parent_comment_id'] == 0) {
        $comment_id = $comment['comment_id'];
        echo '&lt;div&gt;' . $comment['comment'] . '&lt;/div&gt;';

        if($comment_id  == $comment['parent_comment_id']){
            if($comment['user_id'] == $user_id &amp;&amp; $comment['parent_comment_id'] &gt;= 1) {
                $comment_id = $comment['comment_id'];
                echo '&lt;div&gt;' . $comment['comment'] . '&lt;/div&gt;';
            } else if($comment['parent_comment_id'] &gt;= 1) {
                $comment_id = $comment['comment_id'];
                echo '&lt;div&gt;' . $comment['comment'] . '&lt;/div&gt;';
            }
        }
    }       
        make_comments($comment_order[$id]);
    }
}

$dbc = mysqli_query($mysqli, "SELECT articles_comments.comment_id, articles_comments.parent_comment_id, articles_comments.comment, articles_comments.user_id FROM articles_comments LEFT JOIN users ON articles_comments.user_id = users.user_id WHERE article_id = '" . $article_id . "' ORDER BY articles_comments.parent_comment_id ASC");
if (!$dbc) {
    print mysqli_error();
} 

$comment_order = array();

while (list($comment_id, $parent_comment_id, $comment_text, $comment_user, $comment_id) = mysqli_fetch_array($dbc)) {
$comment_order[$parent_comment_id][$comment_id] =  array('parent_comment_id' =&gt; $parent_comment_id, 'comment_id' =&gt; $comment_id, 'comment' =&gt; $comment_text, 'user_id' =&gt; $comment_user, 'comment_id' =&gt; $comment_id);
}

make_comments($comment_order[0], $comment_id);
</code></pre>
