Please help me with my problem.
I am trying to populate a table but 3 of the rows are based on my data in database(it's kinda hard to explain) sample is attach below

this is my query
$query1 = mysql_query("SELECT * FROM tb_grade WHERE instructor_id = '$inst_id' AND description = '$desc' AND remark = '$remark' AND term = '$term' ORDER BY stud_name ASC");
this is my html table
<table class="table table-bordered table-condensed" align="center" bordercolor="#CCCCCC">
<tr bgcolor="#009933">
<td align="center" style="color:#FFF;">Name</td>
<td align="center" style="color:#FFF;">Course</td>
<td align="center" style="color:#FFF;">Prelim</td>
<td align="center" style="color:#FFF;">Midterm</td>
<td align="center" style="color:#FFF;">Final</td>
<td align="center" style="color:#FFF;">Remark</td>
</tr>
<?php
while($result= mysql_fetch_array($query1)){
echo "<tr>";
echo "<td class=\"text-center\">".$result['stud_name']."</td>";
echo "<td class=\"text-center\">"."</td>";
echo "<td class=\"text-center\">".$result['remark']."</td>";
echo "<td class=\"text-center\">"."</td>";
echo "<td class=\"text-center\">"."</td>";
echo "<td class=\"text-center\">"."</td>";
}
?>
</table>
The student will be shown in the table along with his or her remark in every term if he or she failed in every term its either Prelim, Midterm, Final but can be both prelim and midterm, midterm and final, prelim and final. etc. etc. so what is the proper query and arrangement of the table?
