Location: PHPKode > projects > Gatito Prediction League > gatito_pred_league/admin/teamscores.php
<?
$table="";
$pos=1;
$count=1;
//$results= new array();
$query=mysql_query("SELECT distinct team FROM week_totals");
while ($row =@ mysql_fetch_array($query)) {
$gtotal=0;

$team=$row[team];
for ($i=1;$i<=$week;$i=$i+1)
{
$tquery=mysql_query("SELECT pts FROM  week_totals WHERE team='$team' AND week=$i") or die (mysql_error());
$tcount=0;
$total=0;
$score=0;
while ($trow =@ mysql_fetch_array($tquery)) {$score=$trow[pts]+$score;$tcount=$tcount+1;};
if ($score!=0)
{$total=round($score/$tcount,2);
$results[$team]=$total;};
$gtotal=$total+$gtotal;};
echo "$team: $gtotal<br/>";
mysql_query("UPDATE teams SET score='$gtotal' WHERE team = '$team'") ;
};
echo "team scores updated";
?>
Return current item: Gatito Prediction League