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; $tn=0;
while ($db=mysql_fetch_array($result)) {
$sql2="select * from sk1_dbox2 where xsmis='$db[smis]' ";
$result2=mysql_query($sql2);
$db2=mysql_fetch_array($result2);
$nst=mysql_num_rows($result2);
if ($nst==0) { $cst=''; } else { $cst=$nst; }
if (!empty($db2[xpid]) and (!empty($db2[xhome]) or !empty($db2[xrent]) or !empty($db2[xno]))) {
$ast='';
$tn++;
} else {
$ast='';
}
echo "
$rw |
$db[sname] |
$ast $cst |
";
$rw++;
$ttn+=$tn;
$tn=0;
}
//$ttn=number_format($ttn,0,'.',',');
echo "
รวม |
$ttn |
";
?>