header('Content-Type: text/html; charset=tis-620');
include('db_config.php');
$sql0="select schk,count(*) as nev from $_sch where schk<>'' group by schk";
$result0=mysql_query($sql0);
$ev=array(); $i=1;
while ($db0=mysql_fetch_array($result0)) {
$ev[$i]=$db0[nev];
$i++;
}
if (empty($ev[2])) { $ev[2]=0; }
if (empty($ev[3])) { $ev[3]=0; }
$sql="select *,count(*) as nsc from $_sch where level not in ('x','z') group by scgrp order by sampur,scgrp";
$result=mysql_query($sql);
echo <<
สำรวจนักเรียนอายุ 5-11 ปี
ที่ |
กลุ่มโรงเรียน |
ทั้ง หมด |
ราย งาน |
ร้อย ละ |
TH;
$rw=1; $gsc=0;
while ($db=mysql_fetch_array($result)) {
$sql2="select * from $_sch where scgrp='$db[scgrp]' ";
$result2=mysql_query($sql2);
$gts=$gtk=0;
while ($db2=mysql_fetch_array($result2)) {
if (!empty($db2[st511v])) { $gsc++; }
}
if ($gsc > 0) { $gg=$gsc; } else { $gg='-'; }
$perc=number_format($gsc*100/$db[nsc],2,'.','');
$tpc=number_format($gtk*100/$gts,2,'.','');
echo <<
$rw |
$db[sgrp] |
$db[nsc] |
$gg |
$perc |
TB;
$rw++; $tgsc+=$gsc; $gsc=0; $tnsc+=$db[nsc];
$ats+=$gts;
$atk+=$gtk;
}
$tperc=number_format($tgsc*100/$tnsc,2,'.','');
$apc=number_format($atk*100/$ats,2,'.','');
echo <<
รวม |
$tnsc |
$tgsc |
$tperc |
TF;
?>
|