header('Content-Type: text/html; charset=tis-620');
include('../db_config.php');
$sql="select * from sk1_sch where scgrp='$sg' ";
$result=mysql_query($sql);
echo "
ที่ |
โรงเรียน |
นัก เรียน |
ราย งาน |
";
$rw=1; $nrp=0;
while ($db=mysql_fetch_array($result)) {
$sql1="select smis,sum(a1+a2+a3+p1+p2+p3+p4+p5+p6) as std,sum(q21+q22+q23) as lun
from sk1_lunch61 where smis='$db[smis]' ";
$result1=mysql_query($sql1);
$db1=mysql_fetch_array($result1);
if ($db1[std]>0 and $db1[lun]>0) {
$rp='';
$nrp++;
} else {
$rp='';
}
echo "
$rw |
$db[sname] |
$db1[std] |
$rp |
";
$rw++;
$tstd+=$db1[std];
}
echo "
รวม |
$tstd |
$nrp |
";
?>