0
如果學期和的學年與當前表不同,我會創建一個表。Dynamicaly根據列值創建表
從下面的圖片可以看出,「2學期」和「2014學年」的價值基本上是我想要的每個學期和學年都有自己的表格。我不想編碼多個表格,因爲我不確定當前的學年和學期是什麼。
這裏是我的代碼
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>Subject Code</th>
<th>Decription</th>
<th>Grade</th>
<th>Units</th>
<th>Semester</th>
<th>School Year</th>
</tr>
</thead>
<tbody>
<?php
$sql ="SELECT * FROM grades WHERE stud_no ='$stud_no'";
$result = mysqli_query($con, $sql);
while($row = mysqli_fetch_array($result)){
?>
<tr>
<td><?php echo $row['subj_cd'];?></td>
<td><?php echo ucwords(strtolower($row['subj_descr']));?></td>
<td><?php echo $row['final_grade'];?></td>
<td><?php echo $row['units_lec'] + $row['units_lab'];?></td>
<td><?php echo $row['semester'];?></td>
<td><?php echo $row['sch_year'];?></td>
</tr>
</tbody>
<?php
}
?>
</table>
</div>
文件意外結束。 – nethken
已編輯。缺少1「}」 –
每個數據都有一個表:( – nethken