2012-11-25 81 views
-2

我有一個頁面,我希望看到顯示團隊在綠色環境中使用。我有以下SQL:PHP不顯示文字顏色

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 } ?> 

它工作正常的主隊,但它並沒有爲客隊首開紀錄工作,我不明白爲什麼,這對我來說似乎是正確的。有人能指出我的錯誤嗎?

+2

請使用CSS統局字體標籤。 – rekire

+0

是你的結果行集包含$ team ['team'] == $ team ['ateamid']的行嗎? –

回答

0

我發現這個問題,這是與表的錯誤,而不是代碼

-1

那麼,如果我看到它的權利,你忘了在其他情況下設置一個顏色。

if ($team['team'] == $team['fteamid']){ 
    $color="green"; 
} else { 
    $color="red"; 
} 
$html= htmlout($team['awayteamname']); 
echo "<span color='color:$color'>$html</span>"; 
+0

不,我想要它黑色如果你沒有設置顏色,它是如何的,這是一個不工作的客隊,主隊完美的工作 – cameronjonesweb