LawyerMorty

Test Page HTML

Jan 19th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.50 KB | None | 0 0
  1. <?php
  2.     ini_set('display_errors', 1);
  3.     ini_set('display_startup_errors', 1);
  4.     error_reporting(E_ALL);
  5.  
  6.     include('php/classes/sql.php');
  7.    
  8.     define("DB_HOST", "localhost");
  9.     define("DB_USER", "root");
  10.     define("DB_PASS", "Be03121997");
  11.     define("DB_NAME", "gti");
  12.  
  13.     $db = new SQL();
  14.    
  15.     $table = "banking";
  16.     $db->query("SELECT * FROM " . $table . " ORDER BY balance DESC LIMIT 10");
  17.     $bdata = $db->resultset();
  18.    
  19.     $db->query("SELECT * FROM stats ORDER BY kills DESC LIMIT 10");
  20.     $sdata = $db->resultset();
  21. ?>
  22. <html>
  23.     <head>
  24.         <link rel="stylesheet" type="text/css" href="css/test.css">
  25.     </head>
  26.     <body>
  27.         <table style="width: 25%;">
  28.             <caption>Top 10 Richest Players</caption>
  29.             <tr>
  30.                 <th>ID
  31.                 <th>Player
  32.                 <th>Balance
  33.             </tr>
  34.             <?php
  35.                 for ($i = 0; $i < count($bdata); $i++) {
  36.                     echo "<tr class='dr'>";
  37.                     echo "<td>" . ($i + 1);
  38.                     echo "<td>" . $bdata[$i]["name"];
  39.                     echo "<td>$" . number_format(($bdata[$i]["balance"] + $bdata[$i]["cash"]));
  40.                     echo "</tr>";
  41.                 }
  42.             ?>
  43.         </table>
  44.         <table style="width: 30%;">
  45.             <caption>Top 10 Deadliest Players</caption>
  46.             <tr>
  47.                 <th>ID
  48.                 <th>Player
  49.                 <th>Kills
  50.                 <th>Deaths
  51.             </tr>
  52.             <?php
  53.                 for ($i = 0; $i < count($sdata); $i++) {
  54.                     echo "<tr class='dr'>";
  55.                     echo "<td>" . ($i + 1);
  56.                     echo "<td>" . $sdata[$i]["name"];
  57.                     echo "<td>" . number_format($sdata[$i]["kills"]);
  58.                     echo "<td>" . number_format($sdata[$i]["deaths"]);
  59.                     echo "</tr>";
  60.                 }
  61.             ?>
  62.         </table>
  63.     </body>
  64. </html>
Advertisement
Add Comment
Please, Sign In to add comment