title: timetable for scheduled subjects
body: <p>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.</p>
  
  <p>here is the output: </p>
  
  <p><a href="https://i.stack.imgur.com/qRNLz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qRNLz.png" alt="enter image description here"></a></p>
  
  <p>and here is my code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
   $db = new mysqli("localhost", "root", "", "bsu_db");
   if($db-&gt;connect_errno &gt; 0){
       die('Unable to connect to database [' . $db-&gt;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-&gt;query($sqlSubjDay);
   while($rowSubjDay = $qrySubjDay-&gt;fetch_assoc()){
    //array_push($SubjDay, $rowSubjDay['sub_day'], $rowSubjDay['start_time'], $rowSubjDay['end_time']);
    $SubjDay[] = $rowSubjDay;
   }
   json_encode($SubjDay);
  ?&gt;
  &lt;table class="table table-bordered table-condensed"&gt;
   &lt;thead&gt;
    &lt;tr&gt;
     &lt;th&gt;&lt;/th&gt;
     &lt;?php
      foreach ($days as $day ) {
       echo "&lt;th&gt;$day&lt;/th&gt;";
      }
     ?&gt;
    &lt;/tr&gt;
   &lt;/thead&gt;
   &lt;tbody&gt;
   &lt;?php 
    foreach ($times as $time) {      
   ?&gt;
   &lt;tr&gt; 
    &lt;td&gt;&lt;?php echo $time; ?&gt;&lt;/td&gt;
    &lt;?php
     foreach ($days as $day) {           
      echo "&lt;td&gt;";
      foreach($SubjDay as $sd){
             
       if($day == $sd['sub_day'] &amp;&amp; strtotime($time) &gt;= strtotime($sd['start_time']) &amp;&amp; strtotime($time) &lt;= strtotime($sd['end_time'])){
        echo $sd['sub_day'] , " " , $sd['start_time'] , " - " , $sd['end_time'];
       }
             
      }
      echo "&lt;/td&gt;";
     }
  
    ?&gt;
   &lt;/tr&gt;
   &lt;?php   
    } 
   ?&gt;     
   &lt;/tbody&gt;
  &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>