header('Content-Type: text/html; charset=tis-620'); echo ""; include('db_config.php'); mysql_query("TRUNCATE TABLE tmpkap1"); mysql_query("insert into tmpkap1 (SELECT * FROM $_data group by kd_sch,kd_code,g,s,b)"); $sql="select *,sum(g) as g,sum(s) as s,sum(b) as b from tmpkap1,$_act where kp_id=kd_code group by kp_cd order by kp_cd"; $result=mysql_query($sql); echo <<
ที่ | สาระการเรียนรู้ | 1 | 2 | 3 | รวม | ตัวแทน CEO | $rw | $db[kp_abb] | $gg | $ss | $bb | $tot | ดูตัวแทน | TB; $tg+=$db[g]; $ts+=$db[s]; $tb+=$db[b]; $ta+=$db[a]; $total+=$tt; $rw++; } echo <<รวม | $tg | $ts | $tb | $total |