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

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

    
    // $sql = "UPDATE ds18b20 SET `name`='$name' WHERE `address`='$id'";
    $sql = "UPDATE i2cDevices SET `i2cDeviceTypeID`='$i2cDeviceTypeID', `new`='0' WHERE `decAddress`='$a'";
    
    if ($mysqli->query($sql) === TRUE) {
        // echo "Widget Visible updated successfully";
    } else {
        // echo "Error updating Widget Visible: " . $mysqli->error;
    }

    //close connection
    $mysqli->close();
?>