Advertisement
blistovmhz

Untitled

Aug 1st, 2019
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.35 KB | None | 0 0
  1. <html>
  2. <link rel="stylesheet" href="somecss.css">
  3. <body>
  4. <table border="1" cellpadding="5" cellspacing="1" width="1000" align="center">
  5.         <tr class="header">
  6.                 <th>CustomerID</th>
  7.                 <th>SystemID</th>
  8.                 <th>Lattitude</th>
  9.                 <th>Longitude</th>
  10.                 <th>Fix Type</th>
  11.                 <th>Satellites</th>
  12.                 <th>Altitude</th>
  13.                 <th>Time</th>
  14.         </tr
  15. <?php
  16.  
  17. $conn = pg_connect("host=localhost port=5432 dbname=shittyindex user=shittyuser password=shittypassword");
  18. $systems = pg_query($conn, "SELECT DISTINCT systemid FROM gpsdata WHERE customerid = 'somecustomer'");
  19. while ($row = pg_fetch_row($systems)){
  20.         $result = pg_query($conn, "SELECT * FROM gpsdata WHERE systemid = '$row[0]' AND (SELECT MAX (createdat) FROM gpsdata WHERE systemid = '$row[0]') = createdat");
  21.         while ($row = pg_fetch_row($result)){
  22.                 echo "<tr>";
  23.                 echo "<td>$row[0]</td>";
  24.                 echo "<td>$row[1]</td>";
  25.                 echo "<td>$row[2]</td>";
  26.                 echo "<td>$row[3]</td>";
  27.                 echo "<td>$row[4]</td>";
  28.                 echo "<td>$row[5]</td>";
  29.                 echo "<td>$row[6]</td>";
  30.                 echo "<td>$row[7]</td>";
  31.                 echo "</tr>";
  32.         }
  33. }
  34. ?>
  35. </table>
  36. </body>
  37. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement