"; include('header.php'); header('Content-Type: text/html; charset=tis-620'); include_once('db_config.php'); $sql="select * from $_act order by kp_id"; $result=mysqli_query($con,$sql); $db=mysqli_fetch_array($result); $gp=$db[kp_grp]; echo "

สรุปเหรียญรางวัล แยกรายประเภทกีฬา $gp << ส่งออก Excel >> "; $rw=1; $result=mysqli_query($con,$sql); while ($db=mysqli_fetch_array($result)) { echo ""; $sql1="select * from $_data,$_sch where kd_sch=scode and kd_code='$db[kp_code]' and g='1' and kd_rank=1 "; $result1=mysqli_query($con,$sql1); if ($db1=mysqli_fetch_array($result1)) { echo ""; $sql1="select * from $_data,$_sch where kd_sch=scode and kd_code='$db[kp_code]' and (s='1' or kd_rank=2) "; $result1=mysqli_query($con,$sql1); if ($db1=mysqli_fetch_array($result1)) { echo ""; $sql1="select * from $_data,$_sch where kd_sch=scode and kd_code='$db[kp_code]' and (b='1' or kd_rank=3) "; $result1=mysqli_query($con,$sql1); if ($db1=mysqli_fetch_array($result1)) { echo ""; $rw++; } echo "
ที่ ประเภทกีฬา เหรีญทอง (ตัวแทนจังหวัด) เหรียญเงิน เหรียญทองแดง
$rw $db[kp_grp] รุ่น $db[kp_age] ปี $db[kp_act]รร.$db1[sname]
"; } else { echo "
 "; } /* $result1=mysqli_query($con,$sql1); while ($db1=mysqli_fetch_array($result1)) { echo "$db1[kd_std]
"; } */ echo "
รร.$db1[sname]
"; } else { echo "
 "; } /* $result1=mysqli_query($con,$sql1); while ($db1=mysqli_fetch_array($result1)) { echo "$db1[kd_std]
"; } */ echo "
รร.$db1[sname]
"; } else { echo "
 "; } /* $result1=mysqli_query($con,$sql1); while ($db1=mysqli_fetch_array($result1)) { echo "$db1[kd_std]
"; } */ echo "
"; mysqli_close($con); include("footer.php"); ?>