header('Content-Type: text/html; charset=tis-620');
echo "";
include('db_config.php');
mysql_query("TRUNCATE TABLE tmpkap3");
mysql_query("insert into tmpkap3 (SELECT * FROM $_data group by kd_sch,kd_code,g,s,b,a)");
$sql="select *,sum(kd_remark) as nrep,sum(g+s+b+a) as allmed,count(kd_code) as sendall
from tmpkap3,$_sch where kd_sch=scode group by scgrp order by nrep desc";
$result=mysql_query($sql);
echo <<
สรุปเหรียญ แยก CEO เรียงตามจำนวนตัวแทน สพป.
ที่
กลุ่ม CEO
ยอดสมัคร
รวมเหรียญ
ร้อยละ
ตัวแทน
TH;
$rk=1;
while ($db=mysql_fetch_array($result)) {
$sper=number_format($db[allmed]*100/$db[sendall],2,'.',',');
echo <<