<?php

  //setting header to json
  // header('Content-Type: application/json');
  // header("Access-Control-Allow-Origin: *");

  header('Content-type: text/html; Charset=utf-8');

  $id = $_POST["id"];  // get internal sensor id from js
  $driverID = $_POST["driver"];  // get value
  require '../php/database.php';


  $query = 'SELECT timestamp, temp FROM 0317028addff_F';

  //execute query
  $result = $mysqli->query($query);

  //loop through the returned data
  $dataWindow = array();
  foreach ($result as $row) {
    $dataWindow[] = $row;
    // echo $row;
  }

  //free memory associated with result
  $result->close();

  //close connection
  $mysqli->close();
  // print_r(json_encode($dataWindow));
  //now print the data
  print json_encode($dataWindow);