header('Content-Type: text/html; charset=tis-620');
include('../db_config.php');
$sql="select *,count(*) as nsc from sk1_sch where scgrp != 'prv' group by scgrp order by sampur";
$result=mysql_query($sql);
echo "
ที่ |
โรงเรียนในกลุ่ม |
ทั้ง หมด |
รายงาน แล้ว |
ร้อย ละ |
";
$rw=1; $gsc=0;
while ($db=mysql_fetch_array($result)) {
$sql2="select * from sk1_lunch61 a, sk1_sch b
where a.smis=b.smis and b.scgrp='$db[scgrp]' ";
$result2=mysql_query($sql2);
while ($db2=mysql_fetch_array($result2)) {
if (($db2[a1]+$db2[a2]+$db2[a3]+$db2[p1]+$db2[p2]+$db2[p3]+$db2[p4]+$db2[p5]+$db2[p6]>0)
and ($db2[q21]+$db2[q22]+$db2[q23])>0) { $gsc++; }
}
if ($gsc > 0 ) { $gg=$gsc; } else { $gg='-';}
$perc=number_format($gsc*100/$db[nsc],2,'.','');
echo "
$rw |
$db[sgrp] |
$db[nsc] |
$gg |
$perc |
";
$rw++; $tgsc+=$gsc; $gsc=0; $tnsc+=$db[nsc];
}
$tperc=number_format($tgsc*100/$tnsc,2,'.','');
echo "
รวม |
$tnsc |
$tgsc |
$tperc |
![](images/back.png)
";
?>