$queryGetTop = ("SELECT id,name,address,port,vote,isspon FROM servers ORDER BY vote ASC LIMIT 10");
$actionGetTop = mysql_query($queryGetTop);
while ($rowGetTop = mysql_fetch_array($actionGetTop)) {
$countGetTopname[] = $rowGetTop['name'];
$countGetTopip[] = $rowGetTop['address'];
$countGetTopvotes[] = $rowGetTop['vote'];
$countGetTopspon[] = $rowGetTop['isspon'];
$countGetTopport[] = $rowGetTop['port'];
$countGetTopid[] = $rowGetTop['id'];
}
$length = count($countGetTopname);
for ($i = 0; $i > $length; $i++) {
echo $i;
/* echo"
<tbody>
<tr>
<td><span "; if($countGetTopspon[$i] == "1"){echo "class=\"label label-important\">Sponsored</span>";}echo $countGetTopname[$i]."</td>
<td>". $countGetTopip[$i] .":". $countGetTopport[$i] ."</td>
<td>". $countGetTopvotes[$i] ."</td>
</tr>
</tbody>
"; */
}
我做了一些调试,我的 MySQL 数组进入了数组。所以我在 for 循环中回显了 $i 并且没有打印任何内容,所以 for 循环是问题所在。我不确定我做错了什么,循环没有打印任何错误,表格只是没有被打印(当它不在评论中时)。