我有一個幻想曲棍球聯盟的PHP數據庫,我想在一起添加所有的球員總數在一起,我的例子是在這裏。 http://www.cnghl.biz/cnghldb/cnghscorings.php?TeamID=1PHP變量得到一個單一的答案
所以我想舉個例子讓所有的Mike Richards加在一起給我一個GP,G,A,PTS等等,這樣我就可以讓一個Mike Richards把他所有的數據放在一個線。有沒有辦法輕鬆做到這一點?或者這會變得複雜嗎?有人能夠給我那個代碼來啓動它嗎?
//Get TeamID from URL
$iTeamID = $_GET["TeamID"];
$iPlayerID= $_GET["PlayerID"];
$iSea=$_GET["Sea"];
$oteaminfo = mysql_query("
SELECT Players.FullName, Seasonteam.TeamID, SeasonStats.Sea, SeasonStats.GP, SeasonStats.Goals, SeasonStats.Assists, SeasonStats.Points, SeasonStats.Pim, SeasonStats.PlusMinus, SeasonStats.PP, SeasonStats.SH, SeasonStats.GW, SeasonStats.GT, SeasonStats.S, Players.PlayerID
FROM Seasonteam
LEFT JOIN (Players
LEFT JOIN SeasonStats ON Players.PlayerID = SeasonStats.PlayerID)
ON Seasonteam.TeamID = SeasonStats.TeamID
WHERE Seasonteam.TeamID=$iTeamID;
") or die(mysql_error());
Print "<br><br><table border=1 cellpadding=2>";
Print "<td><b><center>Player Name</b></td>";
Print "<td><b><center>GP</center></b></td>";
Print "<td><b><center>G</center></b></td>";
Print "<td><b><center>A</center></b></td>";
Print "<td><b><center>PTS</center></b></td>";
Print "<td><b><center>PIM</center></b></td>";
Print "<td><b><center>+/-</center></b></td>";
Print "<td><b><center>PP</center></b></td>";
Print "<td><b><center>SH</center></b></td>";
Print "<td><b><center>GW</center></b></td>";
Print "<td><b><center>GT</center></b></td>";
Print "<td><b><center>S</center></b></td>";
while($row = mysql_fetch_array($oteaminfo))
{
Print "<tr>";
Print '<td><a href="cnghlplayerinfo.php?PlayerID=' . $row['PlayerID'] . '" style="text-decoration:none;">' . $row['FullName'] . '</a></td>';
Print "<td><center>".$row['GP']."</center></td> ";
Print "<td><center>".$row['Goals']."</center></td> ";
Print "<td><center>".$row['Assists']."</center></td> ";
Print "<td><center>".$row['Points']."</center></td> ";
Print "<td><center>".$row['Pim']."</center></td> ";
Print "<td><center>".$row['PlusMinus']."</center></td> ";
Print "<td><center>".$row['PP']."</center></td> ";
Print "<td><center>".$row['SH']."</center></td> ";
Print "<td><center>".$row['GW']."</center></td> ";
Print "<td><center>".$row['GT']."</center></td> ";
Print "<td><center>".$row['S']."</center></td> ";
Print "</tr>";
}
Print "</table>";
嗯......將它們加在一起? http://en.wikipedia.org/wiki/Addition –
你想團隊總結嗎?我不明白...把它們加在一起? – fmgonzalez
@fmgonzalez我想我已經在想這個了,我正在努力解決這個問題,所以我只給每個玩家一行,他的總數顯示在右邊。如果我添加它們,我會不會顯示4到5個玩家副本,因爲我有多個季節顯示? –