<?php

include "connection.php";
// SQL query to select data from database
$sql = "SELECT * FROM face_table ORDER by id DESC";
$result = mysqli_query($conn,$sql);
?>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>Sensor Details</title>
  <!-- CSS FOR STYLING THE PAGE -->
  <style>
    table {
      margin: 0 auto;
      font-size: large;
      border: 1px solid black;
    }

    h1 {
      text-align: center;
      color: #006600;
      font-size: xx-large;
      font-family: 'Gill Sans', 'Gill Sans MT',
      ' Calibri', 'Trebuchet MS', 'sans-serif';
    }

    td {
      background-color: #E4F5D4;
      border: 1px solid black;
    }

    th,
    td {
      font-weight: bold;
      border: 1px solid black;
      padding: 10px;
      text-align: center;
    }

    td {
      font-weight: lighter;
    }
  </style>
</head>

<body>
  <section>
    <h1>Face Detection</h1>
    <!-- TABLE CONSTRUCTION-->
    <table>
      <tr>
        <th>S.no</th>
        <th>Value1</th>


        <th>Date And Time</th>
      </tr>
      <!-- PHP CODE TO FETCH DATA FROM ROWS-->
      <?php // LOOP TILL END OF DATA
      $i=0;
        while($rows=$result->fetch_assoc())
        {
      ?>
      <tr>
        <!--FETCHING DATA FROM EACH
          ROW OF EVERY COLUMN-->
        <td><?php echo $i; ?></td>
        <td><?php echo $rows['value1'];?></td>

        <td><?php echo $rows['reading_time'];?></td>
      </tr>
      <?php
      $i++;
        }
      ?>
    </table>
  </section>
</body>

</html>