我想知道为什么我的赞助服务器没有被突出显示?
<?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 :(得分:0)
if(sponsor == 0){
无效,且永远不会设置$sponsor
。您可能想要$row['sponsor']
。