Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <link rel="stylesheet" href="somecss.css">
- <body>
- <table border="1" cellpadding="5" cellspacing="1" width="1000" align="center">
- <tr class="header">
- <th>CustomerID</th>
- <th>SystemID</th>
- <th>Lattitude</th>
- <th>Longitude</th>
- <th>Fix Type</th>
- <th>Satellites</th>
- <th>Altitude</th>
- <th>Time</th>
- </tr
- <?php
- $conn = pg_connect("host=localhost port=5432 dbname=shittyindex user=shittyuser password=shittypassword");
- $systems = pg_query($conn, "SELECT DISTINCT systemid FROM gpsdata WHERE customerid = 'somecustomer'");
- while ($row = pg_fetch_row($systems)){
- $result = pg_query($conn, "SELECT * FROM gpsdata WHERE systemid = '$row[0]' AND (SELECT MAX (createdat) FROM gpsdata WHERE systemid = '$row[0]') = createdat");
- while ($row = pg_fetch_row($result)){
- echo "<tr>";
- echo "<td>$row[0]</td>";
- echo "<td>$row[1]</td>";
- echo "<td>$row[2]</td>";
- echo "<td>$row[3]</td>";
- echo "<td>$row[4]</td>";
- echo "<td>$row[5]</td>";
- echo "<td>$row[6]</td>";
- echo "<td>$row[7]</td>";
- echo "</tr>";
- }
- }
- ?>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement