I use this code mount table header after getting some values from DB
I experience a trouble, results are VERTICAL instead horizontal:
Where do I wrong?
EXPECTED
1 2 3 4 5 6
CODE
$query = '1,2,3,4,5,6';
$data = explode(',',$query);
echo '<table>';
foreach($data as $row){
echo '<tr>';
$row = explode(' ',$row);
foreach($row as $cell){
echo '<th>';
echo $cell;
echo '</th>';
}
echo '</tr>';
}
echo '</table>';
Simple HTML work good
<tr>
<th>1</th>
<th>2</th>
<th>3</th>
<th>4</th>
<th>5</th>
<th>6</th>
</tr>