"; include('db_config.php'); $sql1="select * from $_sch where scgrp='$ceo' "; $result1=mysql_query($sql1); $db1=mysql_fetch_array($result1); $sql="select kp_grp,kp_cd from $_act group by kp_cd"; $result=mysql_query($sql); echo "
สรุปผลการรับสมัครฯ แยกตามกลุ่มสาระการเรียนรู้
กลุ่ม $db1[sgrp]
"; $rw=1; $tstd=0; while ($db=mysql_fetch_array($result)) { $sql0="select *,count(*) as nstd from $_data,$_act,$_sch where kd_code=kp_id and kd_sch=scode and kp_cd='$db[kp_cd]' and scgrp='$ceo' group by kp_cd "; $result0=mysql_query($sql0); $db0=mysql_fetch_array($result0); if (empty($db0[nstd])) { $std='-'; } else { $std=$db0[nstd]; } $sql2="select * from $_data,$_act,$_sch where kd_code=kp_id and kd_sch=scode and kp_cd='$db[kp_cd]' and scgrp='$ceo' group by kp_cd,kd_sch "; $result2=mysql_query($sql2); $db2=mysql_fetch_array($result2); $nreg=mysql_num_rows($result2); if (empty($nreg)) { $reg='-'; } else { $reg=$nreg; } echo ""; $rw++; $tact+=$db1[nact]; $tstd+=$db0[nstd]; } echo "
กลุ่มสาระการเรียนรู้ รร.สมัคร จำนวน นร.
$rw.$db[kp_grp] $reg $std
รวม $tstd
"; ?>