Table header from array
<p>I use this code mount table header after getting some values from DB</p>

<p>I experience a trouble, results are VERTICAL instead  horizontal:</p>

<p>Where do I wrong?</p>

<p>EXPECTED</p>

<pre><code>1 2 3 4 5 6
</code></pre>

<p>CODE</p>

<pre><code>$query = '1,2,3,4,5,6';
$data = explode(',',$query);

echo '&lt;table&gt;';
foreach($data as $row){
    echo '&lt;tr&gt;';

    $row = explode(' ',$row);
    foreach($row as $cell){
        echo '&lt;th&gt;';
        echo $cell;
        echo '&lt;/th&gt;';
    }
    echo '&lt;/tr&gt;';
}

echo '&lt;/table&gt;';
</code></pre>

<p>Simple HTML work good</p>

<pre><code>                &lt;tr&gt;
                    &lt;th&gt;1&lt;/th&gt;
                    &lt;th&gt;2&lt;/th&gt;
                    &lt;th&gt;3&lt;/th&gt;
                    &lt;th&gt;4&lt;/th&gt;
                    &lt;th&gt;5&lt;/th&gt;
                    &lt;th&gt;6&lt;/th&gt;
                &lt;/tr&gt;
</code></pre>
