header('Content-Type: text/html; charset=tis-620');
include('../db_config.php');
$sql="select *,sum(jss+js+jm+jl+jxl+j2xl+j3xl+p1ss+p1s+p1m+p1l+p1xl+p12xl+p13xl+p14xl+p15xl+
p2ss+p2s+p2m+p2l+p2xl+p22xl+p23xl+p24xl+p25xl) as shirt
from sk1_sch where scgrp='$sg' group by scode";
$result=mysql_query($sql);
echo "
ที่ |
โรงเรียน |
สั่งเสื้อ |
";
$rw=1;
while ($db=mysql_fetch_array($result)) {
if ($db[shirt]>0 ) {
$ast="$db[shirt]";
$tstd+=$db[shirt];
} else {
$ast='-';
}
echo "
$rw |
$db[sname] |
$ast |
";
$rw++;
}
$tstd=number_format($tstd,0,'.',',');
echo "
รวม |
$tstd |
";
?>