我只想在Department列中输出Agric Department。我该怎么办。提前谢谢。这是我的密码。
<thead>
<tr>
<th>SL</th>
<th>Student Name</th>
<th>Department</th>
<th>Age</th>
<th>Photo</th>
</tr>
</thead>
<tbody>
<?php
$query=mysqli_query($db_con,'SELECT *
FROM `student_info`
ORDER BY `student_info`.`datetime` DESC;');
$i=1;
while ($result = mysqli_fetch_array($query)) { ?>
<tr>
<?php
echo '<td>'.$i.'</td>
<td>'.ucwords($result['name']).'</td>
<td>'.ucwords($result['department']).'</td>
<td>'.ucwords($result['age']).'</td>
<td><img class="rounded-circle avatar-xl" src="../../images/'.$result['photo'].'" ></td>';?>
</tr>
<?php $i++;} ?>
</tbody>
</table>
我试图实现的是只展示农业系的学生
从更改查询
SELECT * FROM `student_info` ORDER BY `student_info`.`datetime` DESC
至
SELECT * FROM `student_info` where department = 'Agric' ORDER BY `student_info`.`datetime` DESC