php - timetable for scheduled subjects -


i got right though problem how can put style on table row has data inside , better if can put rowspan 1 table row.

here output:

enter image description here

and here code:

<?php  	$db = new mysqli("localhost", "root", "", "bsu_db");  	if($db->connect_errno > 0){  	    die('unable connect 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 * 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 $day ) {  					echo "<th>$day</th>";  				}  			?>  		</tr>  	</thead>  	<tbody>  	<?php	  		foreach ($times $time) {						  	?>  	<tr>	  		<td><?php echo $time; ?></td>  		<?php  			foreach ($days $day) {											  				echo "<td>";  				foreach($subjday $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>


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -