Page 147 - MDP2022-2
P. 147
else {
$sql = "INSERT INTO `address`.`addre` (
`key` ,
`name` ,
`phone` ,
`id` ,
`pwd` ,
`temperature_now` ,
`temperature_want` ,
`moist` ,
`led`,
`lg`,
`lk`
)
VALUES (
NULL ,'" . $_POST["name"] . "' ,'" . $_POST["number"] . "' ,'" .
$_POST["id"] . "' ,'" . $_POST["pwd"] . "' ,'20', '20','30','0','0','0');";
mysqli_query($db_connect, $sql);
echo "success";
}
}
else {
echo "blank";
}
}
?>
제어 화면(php)
<?php
include_once "server.inc";
$con = mysqli_connect();
$want = $_POST["want"];
$sw = $_POST["sw"];
$id = $_POST["id"];
if($sw == "3") {
$sql = "UPDATE address.addre SET lg = 0 WHERE addre.id ='" . $id . "';";
mysqli_query($db_connect, $sql);
echo "logout";
}
else if($sw=="2") {
$sql = "UPDATE `address`.`addre` SET `temperature_want` = '" . $want . "' WHERE
`addre`.`id` ='" . $id . "';";
mysqli_query($db_connect, $sql);
}