预定科目的时间表

i got it right though my problem now is how can i put a style on the table row that has the data inside it and much better if i can put rowspan to it so that it will look like one table row.

here is the output:

enter image description here

and here is my code:

<?php
    $db = new mysqli("localhost", "root", "", "bsu_db");
    if($db->connect_errno > 0){
        die('Unable to connect to database [' . $db->connect_error . ']');
    }   
    $times = ["7:00:00", "7:30:00", "8:00:00", "8:30:00", "9:00:00", "9:30:00", "10:00:00", "10:30:00", "11:00:00", "11:30:00", "12:00:00"];
    $days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
    $SubjDay = array();
    $sqlSubjDay = "SELECT * FROM subject_day_tbl";
    $qrySubjDay = $db->query($sqlSubjDay);
    while($rowSubjDay = $qrySubjDay->fetch_assoc()){
        //array_push($SubjDay, $rowSubjDay['sub_day'], $rowSubjDay['start_time'], $rowSubjDay['end_time']);
        $SubjDay[] = $rowSubjDay;
    }
    json_encode($SubjDay);
?>
<table class="table table-bordered table-condensed">
    <thead>
        <tr>
            <th></th>
            <?php
                foreach ($days as $day ) {
                    echo "<th>$day</th>";
                }
            ?>
        </tr>
    </thead>
    <tbody>
    <?php    
        foreach ($times as $time) {                     
    ?>
    <tr>  
        <td><?php echo $time; ?></td>
        <?php
            foreach ($days as $day) {                                           
                echo "<td>";
                foreach($SubjDay as $sd){
                                            
                    if($day == $sd['sub_day'] && strtotime($time) >= strtotime($sd['start_time']) && strtotime($time) <= strtotime($sd['end_time'])){
                        echo $sd['sub_day'] , " " , $sd['start_time'] , " - " , $sd['end_time'];
                    }
                                            
                }
                echo "</td>";
            }

        ?>
    </tr>
    <?php        
        } 
    ?>                   
    </tbody>
</table>

</div>