<?php
require_once('./config/connection.php');
//找出所有队伍
$xtteam=mysql_query("SELECT tid FROM team");
//$row=mysql_fetch_row($xtteam);将每个队伍保存到数组中
while($row=mysql_fetch_row($xtteam)){
foreach ($row as $allcy) {
$allcy=mysql_query("SELECT total FROM member where team_id=$row ");//先找出同一队的所有成员
$cj=0;
while($memrow=mysql_fetch_row($allcy)){
foreach ($memrow as $mycj) {
$cj=$cj+$mycj;
}
$resultteam=mysql_query("UPDATE team set score=$cj where tid=$row ");
if($resultteam&&mysql_affected_rows()>0){
echo "<br />Update <br />";
}else{
echo "False".mysql_errno()." Why:".mysql_error()."<br />";
}
}
}
}
;?>描述:一个组队答题系统,想把每个队伍的每个人的分数汇总后更新到团队分数表中先列出所有团队在列出每个团队的所有人再将每个人的分数累积起来然后更新到team表分数score表有team表 tidscore成员表memberidtotalteam_idNotice: Array to string conversion in on line 8Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given 10
添加回答
举报
0/150
提交
取消