"; include('db_config.php'); mysql_query("TRUNCATE TABLE mt2"); mysql_query("insert into mt2 (SELECT * FROM $_data group by kd_sch,kd_code,g,s,b,a)"); $sql="SELECT *,sum(g) AS go,sum(s) AS sv,sum(b) AS bn,sum(a) AS an FROM mt2,$_reg WHERE kd_sch=scode GROUP BY kd_sch ORDER BY go desc,sv desc,bn desc"; $result=mysql_query($sql); echo "
$_title "; $row=1; $tg=0; $ts=0; $tb=0; $ta=0; $tts=0; while ($db=mysql_fetch_array($result)) { $rg=$db[scode]; $sql2="SELECT kd_sch,count(kd_rank) as rk1 FROM $_data WHERE kd_sch='$rg' and kd_rank=1 GROUP BY kd_sch"; $result2=mysql_query($sql2); $db2=mysql_fetch_array($result2); $rnk1=$db2[rk1]; $sql2="SELECT kd_sch,count(kd_rank) as rk2 FROM $_data WHERE kd_sch='$rg' and kd_rank=2 GROUP BY kd_sch"; $result2=mysql_query($sql2); $db2=mysql_fetch_array($result2); $rnk2=$db2[rk2]; $sql2="SELECT kd_sch,count(kd_rank) as rk3 FROM $_data WHERE kd_sch='$rg' and kd_rank=3 GROUP BY kd_sch"; $result2=mysql_query($sql2); $db2=mysql_fetch_array($result2); $rnk3=$db2[rk3]; if ($rnk1+$rnk2+$rnk3>0) { $trp=$rnk1+$rnk2+$rnk3; } else { $trp='-'; } $total=$db[go]+$db[sv]+$db[bn]+$db[an]; if ($row<$db[mt63]) { $adv=""; $col="#669900"; $dif=abs($row-$db[mt63]); } elseif ($row>$db[mt63]) { $col="#FF0000"; $dif=abs($row-$db[mt63]); $adv=""; } elseif ($row=$db[mt63]) { $dif='-'; $adv=""; } /* if ($row<$db[eef2009]) { $adv=""; $col="#669900"; $dif=abs($row-$db[eef2009]); } elseif ($row>$db[eef2009]) { $col="#FF0000"; $dif=abs($row-$db[eef2009]); $adv=""; } elseif ($row=$db[eef2009]) { $dif='-'; $adv=""; } if ($row<$db[eef2008]) { $adv0=""; $col0="#669900"; $dif0=abs($row-$db[eef2008]); } elseif ($row>$db[eef2008]) { $col0="#FF0000"; $dif0=abs($row-$db[eef2008]); $adv0=""; } elseif ($row=$db[eef2008]) { $dif0='-'; $adv0=""; } */ if ($rnk1==0) { $rnk1='-'; } if ($rnk2==0) { $rnk2='-'; } if ($rnk3==0) { $rnk3='-'; } if (substr($db[abreg],0,3)=='È¡.') { $bg='#ffcc99'; } else { $bg='#ffffff'; } echo ""; $row++ ; } echo "
·Õè ʾ». à¢éÒ
ÃèÇÁ
ÃÇÁ ª¹Ð
àÅÔÈ
ÃͧÏ
Íѹ´Ñº 1
ÃͧÏ
Íѹ´Ñº 2
ÃÇÁ Íѹ´Ñº ¤ÃÑ駷Õè 63
$row $db[sname] $db[go] $db[sv] $db[bn] $db[an] $total $rnk1 $rnk2 $rnk3 $trp $db[mt63] $adv $dif
"; ?>