<?php
//setting header to json 
    header("Content-type: application/json");
    $d1 = $_POST["d1"];  // get internal sensor id from js
    $d2 = $_POST["d2"];
    require '../php/database.php';

    $query = "UPDATE systemSettings SET `db9_1`='$d1', `db9_2`='$d2' WHERE `userID`='1'";

    if ($mysqli->query($query) === TRUE) {
        // echo "Widget Visible updated successfully";
    } else {
        // echo "Error updating Widget Visible: " . $mysqli->error;
    }
    
    //execute query
    $result = $mysqli->query($query);

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

    // $dataWindow = array();
    print json_encode($dataWindow);
?>