如何从已添加到调度程序表中的主题表中排除要显示的主题?我有这个代码,但它仍然显示已添加到调度表的主题。
<?php
$sem = $_GET['semChooser'];
$res = mysql_query("SELECT * FROM scheduler WHERE semester = '$sem'") or die(mysql_errno());
$row=mysql_fetch_array($res);
$subName = $row['subject_name'];
$res1 = mysql_query("SELECT * FROM subject WHERE semester IN ('$sem', 3) AND subject_name != '$subName'") or die(mysql_errno());
while ($row=mysql_fetch_array($res1)) {
echo "
<tr class='active'>
<td align='center'>
<button type='submit' data-dismiss='modal' class='btn btn-primary btn-block btn-xs subject'><em class='fa fa-plus'></em> Add</button>
</td>
<td>".$row['subject_code']."</td>
<td>".$row['subject_name']."</td>
<td>".$row['subject_type']."</td>
<td>".$row['room_type']."</td>
<td>".$row['subject_category']."</td>
<td>".$row['year_level']."</td>
<td>".$row['units']."</td>
</tr> "; }
?>
1条答案
按热度按时间f0brbegy1#
您可以使用subselect并仅通过一个查询获得结果