2015-06-07 82 views
0

我想知道爲什麼我的贊助服務器沒有被突出顯示?顯示贊助商服務器不同顏色不顯示php

<?php 
require_once('mysql_connect.php'); 

$query = "SELECT id, name, banner, description, sponsor, votes, hits FROM websites ORDER BY votes DESC LIMIT 50"; 
$result = mysql_query($query) OR die(mysql_error()); 
// Rank counter 
$rank = 1; 
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { 
    //it would wrap your text upto 20 characters 
    $wrappedText = wordwrap(substr($row['description'], 0, 200), 55, "<br />\n", true); 

    if(sponsor == 0){ 
     echo '<tbody> 
    <tr class="server glossed site"> 
     <td class="rank hidden-sm hidden-xs"> 
     '.$rank.'</td> 
     <td class="description"><p><a href="out.php?id='.$row['id'].'" target="_blank">'.$row['name'].'<br /><p><a href="out.php?id='.$row['id'].'" rel="no_follow" target="_blank"><img src="'.$row['banner'].'" width="470" height="60"></a></p></a><br><p class="hidden-sm hidden-xs">'. 
     $wrappedText.'</p></td> 
     <td class="votes hidden-sm hidden-xs">'.$row['votes'].'</td> 
    </tr>'; 
    } else { 
     echo '<tbody> 
    <tr class="server sponsor site"> 
     <td class="rank hidden-sm hidden-xs"> 
     '.$rank.'</td> 
     <td class="description"><p><a href="out.php?id='.$row['id'].'" target="_blank">'.$row['name'].'<br /><p><a href="out.php?id='.$row['id'].'" rel="no_follow" target="_blank"><img src="'.$row['banner'].'" width="470" height="60"></a></p></a><br><p class="hidden-sm hidden-xs">'. 
     $wrappedText.'</p></td> 
     <td class="votes hidden-sm hidden-xs">'.$row['votes'].'</td> 
    </tr>'; 
    } 
$rank++; 
} 
?> 

我加入的CSS,我相信的..

.server.sponsor{ 
    background-color:#9dd0f6; 
    border:1px solid #ccc; 
    border-bottom:1px solid #aaa 
} 

但它不會顯示爲選定保薦網站的色彩。

+0

生成的HTML是否顯示具有正確類的行?您的瀏覽器的檢查員是否顯示了覆蓋樣式的另一個規則?你做了什麼基本的故障排除? – ceejayoz

+0

不,它不顯示爲贊助時,我檢查元素 – KIXEYE

+0

然後檢查$贊助商的價值。它應該是$ row ['sponsor']? – ceejayoz

回答

0

if(sponsor == 0){是不合法的PHP和$sponsor從未設置。你可能想要$row['sponsor']