"; include('header.php'); header('Content-Type: text/html; charset=tis-620'); include_once('db_config.php'); $sql="select *,sum(g) as gd,sum(s) as sv,sum(b) as bn from $_data where (g>0 or s>0 or b>0) group by kd_std order by gd desc,sv desc,bn desc"; $result=mysqli_query($con,$sql); echo "

"; while ($db=mysqli_fetch_array($result)) { $sql1="select scode,sname from $_sch where scode='$db[kd_sch]' "; $result1=mysqli_query($con,$sql1); $db1=mysqli_fetch_array($result1); if ($db[gd]>0) { $gd=$db[gd]; } else { $gd='-'; } if ($db[sv]>0) { $sv=$db[sv]; } else { $sv='-'; } if ($db[bn]>0) { $bn=$db[bn]; } else { $bn='-'; } echo ""; } echo "
นักกีฬาที่ได้รับเหรียญรางวัลทั้งหมด
$gd $sv $bn $db[kd_std]
รร.$db1[sname]
"; mysqli_close($con); include('footer.php'); ?>