-2

チームがプレーした緑色の表示を見たいページがあります。私は次のSQLを持っています:

SELECT performance.id, matchid, playerid, team, debut, batpos, runs, ballsfaced, runs/ballsfaced*100 AS strikerate, fours, sixes, no, howout, fielder, bowler, ballsbowled, maidens, wickets, runsconceded, catches, stumpings, runouts, runsconceded/ballsbowled/6 AS economy, matches.round, matches.season, teams.id AS fteamid, a.id AS ateamid, teams.name AS hometeamname, a.name AS awayteamname, players.fname, players.surname 
                    FROM performance 
                    INNER JOIN matches ON performance.matchid=matches.id 
                    INNER JOIN teams ON matches.hometeam = teams.id 
                    INNER JOIN (SELECT teams.id, name FROM teams) AS a ON matches.awayteam = a.id
                    INNER JOIN players ON performance.playerid=players.id

そして、次のphpステートメント:

<?php 
          //if they play for this team display in green
          if ($team['team'] == $team['fteamid']){
          ?>
          <font color="green"><?php htmlout($team['hometeamname']); ?></font>
          <?php } else {
              ?> <?php htmlout($team['hometeamname']); ?> 
              <?php } ?>
              v 
              <?php 
          //if they play for this team display in green
          if ($team['team'] == $team['ateamid']){
          ?>
          <font color="green"><?php htmlout($team['awayteamname']); ?></font>
          <?php } else {
              ?> <?php htmlout($team['awayteamname']); ?> 
              <?php } ?>

ホームチームでは問題なく機能しますが、アウェイチームでは機能せず、理由がわかりません。私には正しいようです。誰かが私のエラーを指摘できますか?

4

2 に答える 2

0

私は問題を見つけました、それはコードではなくテーブルのエラーでした

于 2012-11-25T22:20:57.587 に答える
-1

さて、私がそれを正しく見れば、あなたはあなたの他の場合に色を設定するのを忘れました。

if ($team['team'] == $team['fteamid']){
    $color="green";
} else {
    $color="red";
}
$html= htmlout($team['awayteamname']); 
echo "<span color='color:$color'>$html</span>";
于 2012-11-25T07:44:45.237 に答える