header('Content-Type: text/html; charset=tis-620');
include('../db_config.php');
$sql="select * from sk1_std59 a,sk1_sch b where a.smis=b.smis and scgrp='$sg' ";
$result=mysql_query($sql);
echo "
ที่ |
โรงเรียน |
นักเรียน(รวม) |
";
$rw=1;
while ($db=mysql_fetch_array($result)) {
$allstd=$db[a1m]+$db[a1f]+$db[a2m]+$db[a2f]+$db[p1m]+$db[p1f]+$db[p2m]+$db[p2f]+$db[p3m]+$db[p3f]+
$db[p4m]+$db[p4f]+$db[p5m]+$db[p5f]+$db[p6m]+$db[p6f]+
$db[m1m]+$db[m1f]+$db[m2m]+$db[m2f]+$db[m3m]+$db[m3f]+
$db[m4m]+$db[m4f]+$db[m5m]+$db[m5f]+$db[m6m]+$db[m6f];
if ($allstd>0) { $ast=$allstd; } else { $ast='-'; }
echo "
$rw |
$db[sname] |
$ast |
";
$rw++; $tstd+=$allstd;
}
$tstd=number_format($tstd,0,'.',',');
echo "
รวม |
$tstd |
";
?>