09.09.2012, 14:12
PHP код:
<?php
$query = mysql_query("SELECT `id`,`Name`,`AdminLevel` FROM `players` WHERE `AdminLevel` >0 ORDER BY `AdminLevel` DESC");
echo '<table>';
echo '<tr><td>id</td><td>Name</td><td>Level</td></tr>';
while ($row = mysql_fetch_array($query))
{
if(!isset($string)) $string = $row['Name'] . ", ";
else $string = $string . $row['Name'] . ", ";
echo '<tr><td>'.$row['id'].'</td><td>'.$row['Name'].'</td><td>'.$row['AdminLevel'].'</td></tr>';
}
echo '</table>';
for ($i=5; $i>0; $i--)
{
if($i == 666) echo "<h2>Owner</h2>";
else echo "<h2>Level $i</h2>";
$result = mysql_query("SELECT `Name` FROM `players` WHERE AdminLevel = $i");
if(!mysql_num_rows($result)) echo "None";
else
{
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
if(!isset($string)) $string = $row['user'] . ", ";
else $string = $string . $row['user'] . ", ";
}
$string=substr($string,0,(strlen($string)-2));
echo $string;
}
echo "<p>";
$string = '';
}
?>