Добрый день!
Прошу помощи так как не хватает знаний на реализацию. Написал следующий код (CMS NetCat)
<section class="section-block">
<div class="row">
<article class="post">
<!— <table border='1' bordercolor='#999' cellpadding='10' cellspacing='0' style='border-collapse: collapse' widtd='100%' height='100%'> —>
<h2 class='make-a-padding'><?= $current_cc[Sub_Class_Name]; ?></h2>
<table class="showall" border=4 bordercolor='#999' cellpadding='10' cellspacing='0' style='border-collapse: collapse;' widtd='100%' height='100%'>
<?
foreach($db->get_results("SELECT * FROM Message2020 WHERE Parent_Message_ID='0' AND Sub_Class_ID='$cc' ORDER BY Message_ID") as $day){
$count=$db->get_row("SELECT COUNT(*) as Total FROM Message2020 as a JOIN Message2007 as b ON a.razdel_Napravleniya=b.Message_ID JOIN Message2010 as c ON a.razdel_Prepod=c.Message_ID JOIN Classificator_ListWncTypeRaspis as d ON a.spisok_ListWncTypeRaspis=d.ListWncTypeRaspis_ID WHERE a.Parent_Message_ID='$day->Message_ID' ORDER BY a.TimeStart",ARRAY_A);
echo "<td bgcolor='#ccc' rowspan='".($count[Total] ? $count[Total] : 1)."' style='text-align:center; border-bottom: 4px solid #999; height:200px;'><div style='-webkit-transform: rotate(-90deg); -moz-transform: rotate(-90deg); -ms-transform: rotate(-90deg); -o-transform: rotate(-90deg); transform: rotate(-90deg);'>".$day->Day."</div></td>";
$firstrow=0;
$written=false;
foreach($db->get_results("SELECT a.TimeStart, a.TimeEnd, b.Name, c.Name as Prepod, c.Message_ID as PrepodID, b.Subdivision_ID, d.ListWncTypeRaspis_Name as Type, a.Description FROM Message2020 as a JOIN Message2007 as b ON a.razdel_Napravleniya=b.Message_ID JOIN Message2010 as c ON a.razdel_Prepod=c.Message_ID JOIN Classificator_ListWncTypeRaspis as d ON a.spisok_ListWncTypeRaspis=d.ListWncTypeRaspis_ID WHERE a.Parent_Message_ID='$day->Message_ID' ORDER BY a.TimeStart") as $item){
if($firstrow)echo "<tr>";
$naaame=$db->get_results("SELECT `KeyPost` FROM `Message2007` WHERE `Subdivision_ID`='".$item->Subdivision_ID."'");
if($naaame[0]->KeyPost==''){$nameEND=$item->Name;}else{$nameEND=$naaame[0]->KeyPost;}
echo "<td style='border-bottom: 4px solid #999;'>".$item->TimeStart."-".$item->TimeEnd."</td><td style='border-bottom: 4px solid #999;'><a style='color: #1e3f93; float: right; line-height: 18px; text-align: right !important;' href='".nc_folder_url($item->Subdivision_ID, null, null )."'>".$nameEND."</td><td style='border-bottom: 4px solid #999;'><a style='color: #c31c1c; float: left; line-height: 18px;' href='".nc_message_link($item->PrepodID,2010)."'>".$item->Prepod."</a></td><td style='border-bottom: 4px solid #999;'>".$item->Type."</td><td style='border-bottom: 4px solid #999;'>".$item->Description."</td></tr>";
$firstrow=1;
$written=true;
}
if(!$written)echo "<td></td><td></td><td></td><td></td><td></td></tr>";
}
?>
</table>
Что нужно изменить чтобы получилась следующая таблица?