Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $db = mysqli_connect("localhost","USERNAME","PASSWORD","sa");
- $sql = "SELECT * FROM measure";
- switch ($_GET['sort_by']) {
- case "mods":
- $sql .= " ORDER BY mods";
- break;
- case "total":
- $sql .= " ORDER BY total";
- break;
- case "auto":
- $sql .= " ORDER BY autobans";
- break;
- case "bans":
- $sql .= " ORDER BY bans";
- break;
- case "perma":
- $sql .= " ORDER BY permabans";
- break;
- case "probate":
- $sql .= " ORDER BY probations";
- break;
- default:
- break;
- }
- if ($_GET['sort_by'] != "")
- {
- if ($_GET['desc'] == 1)
- {
- $sql .= " DESC";
- }
- }
- $result = mysqli_query($db,$sql);
- ?>
- <html>
- <head>
- <title>Leper's Colony • Burn all mods edition</title>
- <style type="text/css">
- .results
- {
- margin-left: 4%;
- }
- </style>
- </head>
- <body>
- <p class="results"><strong><?php echo mysqli_num_rows($result); ?></strong> horrible mods have made requests. Dammit!</p>
- <table>
- <tr>
- <th><a href="?sort_by=mods">HORRIBLE MOD</a></th>
- <th><a href="?sort_by=total">TOTAL</a></th>
- <th><a href="?sort_by=auto">AUTOBANS</a></th>
- <th><a href="?sort_by=bans">BANS</a></th>
- <th><a href="?sort_by=perma">PERMABANS</a></th>
- <th><a href="?sort_by=probate">PROBATIONS</a></th>
- </tr>
- <tr>
- <th><a href="?sort_by=mods&desc=1">[DESCENDING]</a></th>
- <th><a href="?sort_by=total&desc=1">[DESCENDING]</a></th>
- <th><a href="?sort_by=auto&desc=1">[DESCENDING]</a></th>
- <th><a href="?sort_by=bans&desc=1">[DESCENDING]</a></th>
- <th><a href="?sort_by=perma&desc=1">[DESCENDING]</a></th>
- <th><a href="?sort_by=probate&desc=1">[DESCENDING]</a></th>
- </tr>
- <?php
- // this creates a row of data for each row that exists (there's about ~302 as of Jan 24, 2014)
- while($row = mysqli_fetch_assoc($result))
- {
- extract($row);
- ?>
- <tr>
- <td><?php echo $row['mods']; ?></td>
- <td><?php echo $row['total']; ?></td>
- <td><?php echo $row['autobans']; ?></td>
- <td><?php echo $row['bans']; ?></td>
- <td><?php echo $row['permabans']; ?></td>
- <td><?php echo $row['probations']; ?></td>
- </tr>
- <?php
- }
- ?>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement