header('Content-Type: text/html; charset=tis-620');
global $scid;
include('db_config.php');
$sql0="select scode,sname,sgrp from kap4_sch where scode='$scid'" ;
$result0=mysql_query($sql0);
$db0=mysql_fetch_array($result0);
$scname=$db0[sname];
$sgrp=$db0[sgrp];
$sql="SELECT kd_id,kd_code,kd_sch,kd_std,kd_tutor,kd_rank,g,s,b,kd_score,scode,sname,kp_code,kp_grp,kp_act,kp_level
FROM kap4_act,kap4_sch,kap4_data
WHERE kd_code=kp_code and kd_sch=scode and kd_sch='$scid' and g+s+b>0 order by g desc,s desc,b desc,kd_code";
$result=mysql_query($sql);
echo "สรุปเหรียญรางวัล แยกประเภท โรงเรียน $scname กลุ่มโรงเรียน $sgrp";
echo "