I have a problem when coding in PHP.
I have a data in mysql like this:
$data_room = '2010,2011|Math-9,Informatic-8,History-6,Moresingle-5,Other-8
2011,2012|Math-6,Informatic-7,History-5,Moresingle-3,Other-7';
echo '<table><tbody>';
$data = explode("
", $data_room);
foreach($data as $row){
echo '<tr>';
$row = explode('|',$row);
echo '<td>';
foreach($row as $cell){
$row2 = explode(',',$cell);
echo $row2[0].'->'.$row2[0].'</td></tr><tr>';
foreach($row2 as $cell2){
echo '<td>';
echo $cell2;
echo '</td>';
}
echo '</tr>';
}
}
echo '</tbody></table>';
Now I want to show it in a table like this:
How can I do it?