Advertisement
Guest User

Untitled

a guest
Mar 4th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. <?php
  2. $host = "EDITTHIS";
  3. $username = "EDITTHIS";
  4. $password = "EDITTHIS";
  5. $database = "EDITTHIS";
  6.  
  7. $mysqli = new mysqli($host, $username, $password, $database);
  8.  
  9. if ($mysqli->connect_error) {
  10. die('Connect Error (' . $mysqli->connect_errno . ') '
  11. . $mysqli->connect_error);
  12. }
  13.  
  14. $sql = 'SELECT Name,Banned,BannedReason FROM PlayerStats WHERE banned = -1 OR banned > 0';
  15.  
  16. $query = mysqli_query($mysqli, $sql);
  17.  
  18. if (!$query) {
  19. die ('SQL Error: ' . mysqli_error($conn));
  20. }
  21. $mysqli->close();
  22.  
  23. ?>
  24.  
  25. <html>
  26. <head>
  27. <title>Displaying MySQL Data in HTML Table</title>
  28. <style type="text/css">
  29. body {
  30.  
  31. font-size: 15px;
  32. color: #c64800;
  33. font-family: "segoe-ui", "open-sans", tahoma, arial;
  34. padding: 0;
  35. margin: 0;
  36. }
  37. table {
  38. margin: auto;
  39. font-family: "Lucida Sans Unicode", "Lucida Grande", "Segoe Ui";
  40. font-size: 12px;
  41. }
  42.  
  43. h1 {
  44. margin: 25px auto 0;
  45. text-align: center;
  46. text-transform: uppercase;
  47. font-size: 17px;
  48. }
  49.  
  50. table td {
  51. transition: all .5s;
  52. }
  53.  
  54. /* Table */
  55. .data-table {
  56. border-collapse: collapse;
  57. font-size: 14px;
  58. min-width: 537px;
  59. }
  60.  
  61. .data-table th,
  62. .data-table td {
  63. border: 1px solid #e1edff;
  64. padding: 7px 17px;
  65. }
  66. .data-table caption {
  67. margin: 7px;
  68. }
  69.  
  70. /* Table Header */
  71. .data-table thead th {
  72. background-color: #508abb;
  73. color: #FFFFFF;
  74. border-color: #6ea1cc !important;
  75. text-transform: uppercase;
  76. }
  77.  
  78. /* Table Body */
  79. .data-table tbody td {
  80. color: #353535;
  81. }
  82. .data-table tbody td:first-child,
  83. .data-table tbody td:nth-child(4),
  84. .data-table tbody td:last-child {
  85. text-align: center;
  86. }
  87.  
  88. .data-table tbody tr:nth-child(odd) td {
  89. background-color: #f4fbff;
  90. }
  91. .data-table tbody tr:hover td {
  92. background-color: #ffffa2;
  93. border-color: #ffff0f;
  94. }
  95.  
  96. /* Table Footer */
  97. .data-table tfoot th {
  98. background-color: #e5f5ff;
  99. text-align: right;
  100. }
  101. .data-table tfoot th:first-child {
  102. text-align: left;
  103. }
  104. .data-table tbody td:empty
  105. {
  106. background-color: #ffcccc;
  107. }
  108. </style>
  109. </head>
  110. <body>
  111. <h1>BD:RP Ban list</h1>
  112. <table class="data-table">
  113. <caption class="title">Here you can see Breaking Desert Roleplay bans.</caption>
  114. <thead>
  115. <tr>
  116. <th>NO</th>
  117. <th>Name</th>
  118. <th>Reason</th>
  119. <th>Expiry Date</th>
  120. </tr>
  121. </thead>
  122. <tbody>
  123. <?php
  124. $no = 1;
  125. while ($row = mysqli_fetch_array($query))
  126. {
  127. $expiry = "Never";
  128. if($row['Banned'] > 0) $expiry = gmdate("d/m/Y\ H:i", $row['Banned']);
  129. echo '<tr>
  130. <td>'.$no.'</td>
  131. <td>'.$row['Name'].'</td>
  132. <td>'.$row['BannedReason'].'</td>
  133. <td>'.$expiry.'</td>
  134. </tr>';
  135. $no++;
  136. }?>
  137. </tbody>
  138. </table>
  139. </body>
  140. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement