$grp=$_GET["grp"]; header('Content-Type: text/html; charset=tis-620'); echo ""; include('db_config.php'); mysql_query("TRUNCATE TABLE tmpkap5"); mysql_query("insert into tmpkap5 (SELECT * FROM $_data group by kd_sch,kd_code,g,s,b,a)"); if ($grp=='04') { $sql="select *,sum(g) as g,sum(s) as s,sum(b) as b from tmpkap5,$_act where kp_code=kd_code and kp_cd in ('04','05','06') group by kp_code order by kp_grp,kp_code,kd_rank"; } elseif ($grp=='12') { $sql="select *,sum(g) as g,sum(s) as s,sum(b) as b from tmpkap5,$_act where kp_code=kd_code and kp_cd in ('12','13','14','15') group by kp_code order by kp_grp,kp_code,kd_rank"; } else { $sql="select *,sum(g) as g,sum(s) as s,sum(b) as b from tmpkap5,$_act where kp_code=kd_code and kp_cd='$grp' group by kp_code order by kp_grp,kp_code,kd_rank"; } $result=mysql_query($sql); echo "
ที่ | รหัส | กลุ่มสาระ | กิจกรรม | รวม | |||
$rw | $db[kp_code] | $db[kp_grp] | $db[kp_act] | $db[g] | $db[s] | $db[b] | $tt |
รวม | $tg | $ts | $tb | $total |