Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.82 KB | None | 0 0
  1.     <div class="page-section-server-stats">
  2.       <h2>Top <b>5</b> Highest Scoring Players:</h2>
  3.       <div class="table-responsive">
  4.         <table class="table table-striped table-bordered" style="width:700px;" align="center">
  5.             <tr>
  6.                 <th>Rank</th>
  7.                 <th>Name</th>
  8.                 <th>Score</th>
  9.             </tr>
  10.        
  11.             <?php
  12.             //First get the last 5.
  13.             $query = mysql_query("SELECT * FROM playerdata ORDER BY score DESC LIMIT 5");
  14.            
  15.             //Loop through the rows and show each.
  16.             $curRow = 1;
  17.             while ($row = mysql_fetch_array($query, MYSQL_ASSOC))
  18.             {
  19.                 //Start printing.
  20.                 echo '<tr>';
  21.                     echo "<td>#$curRow</td>";
  22.                     echo '<td>'
  23.                         echo $row['nick'];
  24.                     echo '</td>'
  25.                     echo '<td>'
  26.                         echo $row['score'];
  27.                     echo '</td>'
  28.                 echo '</tr>'
  29.                
  30.                 $curRow += 1;
  31.             }
  32.             ?>
  33.         </table>
  34.       </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement