Advertisement
BilkaPek

latest_Flights-PART

Mar 22nd, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.71 KB | None | 0 0
  1.                     <div class="panel-body">
  2.                         <?php
  3.                             $db = new mysqli($db_host , $db_username , $db_password , $db_database);
  4.                             $db->set_charset("utf8");
  5.                             if ($db->connect_errno > 0) {
  6.                                 die('Unable to connect to database [' . $db->connect_error . ']');
  7.                             }
  8.                             $sql = "SELECT v.gvauser_id,a1.name AS dep_name, a2.name AS arr_name, a1.iso_country AS dep_country,a2.iso_country AS arr_country,
  9.                                          v.callsign,v.gvauser_id,v.departure,v.arrival, DATE_FORMAT(v.flight_date,'$va_date_format') AS date_string, v.flight_date,
  10.                                          format(v.flight_duration,2) AS vtime, v.landing_vs FROM vampireps v, airports a1, airports a2
  11.                                          INNER JOIN vampireps vp
  12.                                        WHERE v.departure=a1.ident
  13.                                              AND v.arrival=a2.ident
  14.                                              AND vp.gvauser_id = v.gvauser_id
  15.                                              AND v.flight_duration IS NOT NULL
  16.                                        GROUP BY v.id DESC LIMIT 5";
  17.                             if (!$result = $db->query($sql)) {
  18.                                 die('There was an error running the query [' . $db->error . ']');
  19.                             }
  20.                         ?>
  21.                         <div class="table-responsive">
  22.                             <table class="table table-hover">
  23.                                 <?php
  24.                                     echo "<thead><tr><th>" . LF_CALLSIG . "</th><th>" . LF_PILOT . "</th><th>" . LF_DEPARTURE . "</th><th>" . LF_ARRIVAL . "</th><th>" . LF_FLIGHTDATE . "</th><th>" . LF_FLIGHTTIME . "</th></tr></thead>";
  25.                                     while ($row = $result->fetch_assoc()) {
  26.                                         echo '<td>';
  27.                                         echo '<a href="./index.php?page=pilot_details&pilot_id=' . $row["gvauser_id"] . '">' . $row["callsign"] . '</a></td><td>';
  28.                                         echo $row["pilot_name"] . '</td><td>';
  29.                                         echo '<IMG src="images/icons/ic_flight_takeoff_black_18dp_2x.png" WIDTH="20" HEIGHT="20" BORDER=0 ALT="">&nbsp;<IMG src="images/country-flags/'.$row["dep_country"].'.png" WIDTH="25" HEIGHT="20" BORDER=0 ALT="">&nbsp;<a href="./index.php?page=airport_info&airport=' . $row["departure"] . '">' . $row["departure"] . '</a></td><td>';
  30.                                         echo '<IMG src="images/icons/ic_flight_land_black_18dp_2x.png" WIDTH="20" HEIGHT="20" BORDER=0 ALT="">&nbsp;<IMG src="images/country-flags/'.$row["arr_country"].'.png" WIDTH="25" HEIGHT="20" BORDER=0 ALT="">&nbsp;<a href="./index.php?page=airport_info&airport=' . $row["arrival"] . '">' . $row["arrival"] . '</a> </td><td>';
  31.                                         echo $row["date_string"] . '</td><td>';
  32.                                         echo '<i class="fa fa-clock-o"></i>&nbsp;'.convertTime($row["vtime"],$va_time_format). '</td></tr>';
  33.                                     }
  34.                                 ?>
  35.                             </table>
  36.                         </div>
  37.                     </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement