Advertisement
Guest User

top_five_vs.php

a guest
Sep 7th, 2017
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.47 KB | None | 0 0
  1. <?php
  2.     /**
  3.      * @Project: Virtual Airlines Manager (VAM)
  4.      * @Author: Alejandro Garcia
  5.      * @Web http://virtualairlinesmanager.net
  6.      * Copyright (c) 2013 - 2016 Alejandro Garcia
  7.      * VAM is licensed under the following license:
  8.      *   Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)
  9.      *   View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/4.0/
  10.      */
  11. ?>
  12. <?php
  13.     $db = new mysqli($db_host , $db_username , $db_password , $db_database);
  14.     $db->set_charset("utf8");
  15.     if ($db->connect_errno > 0) {
  16.         die('Unable to connect to database [' . $db->connect_error . ']');
  17.     }
  18.     $sql = "SELECT g.name, g.surname, g.callsign, v.landing_vs as vtouch, v.created_at FROM vampireps v
  19.         INNER JOIN gvausers g on g.gvauser_id = v.gvauser_id
  20.         WHERE  v.created_at >= (CURDATE() - INTERVAL 7 DAY)
  21.         GROUP BY g.name,  g.surname, g.callsign ORDER BY v.landing_vs DESC LIMIT 5";
  22.     if (!$result = $db->query($sql)) {
  23.         die('There was an error running the query [' . $db->error . ']');
  24.     }
  25.     echo '<table class="table table-hover">';
  26.     echo '<tr><th>' . STATISTICS_CALLSIGN . '</th><th>' . STATISTICS_PILOT . '</th><th>' . STATISTICS_TOUCH . '</th></tr>';
  27.     while ($row = $result->fetch_assoc()) {
  28.         echo "<tr><td>";
  29.         echo $row["callsign"] . '</td><td>';
  30.         echo $row["name"] . ' ' . $row["surname"] . '</td><td>';
  31.         echo number_format($row["vtouch"],2) . ' ft/min </td>';
  32.         echo "</tr>";
  33.     }
  34.     echo "</table></br>";
  35.     $db->close();
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement