select `class_sn`, `subject`, `class_name`, `teacher` FROM `tncomu_class` WHERE `access`='1' and `seme`='現在的學期' order by `subject`
$opt="<select name='class_sn'>"; while(list($class_sn , $subject, $class_name, $ teacher) = mysql_fetch_row($result)){ $selected=($default_class_sn==$class_sn)?"selected":""; $opt.="<option value='{$class_sn}' $selected> {$class_name} </option>"; } $opt.="</select>";
if($月<=2){ $seme=去年第2學期; }elseif($月>=3 and $月<=8){ $seme=今年第1學期; }else{ $seme=今年第2學期; }
select a.* , b.`class_name` from `tncomu_article` as a left join `tncomu_class` as b on a.`class_sn`=b.`class_sn` where a.seme='本學期' and a.`enable`='1'