Page 148 - MDP2022-2
P. 148
else if($sw=="1") {
$sql = "UPDATE `address`.`addre` SET `led` = '1' WHERE `addre`.`id` ='" . $id . "';
";
mysqli_query($db_connect, $sql);
}
else if($sw=="0") {
$sql = "UPDATE `address`.`addre` SET `led` = '0' WHERE `addre`.`id` = '" . $id . "
';";
mysqli_query($db_connect, $sql);
}
else if($sw=="10") {
$sql = "UPDATE `address`.`addre` SET `lk` = '0' WHERE `addre`.`id` ='" . $id . "';";
mysqli_query($db_connect, $sql);
}
else if($sw=="20") {
$sql = "UPDATE `address`.`addre` SET `lk` = '1' WHERE `addre`.`id` = '" . $id . "';
";
mysqli_query($db_connect, $sql);
}
else if($sw == "5") {
$sql = "UPDATE address.addre SET lg = 1 WHERE addre.id ='" . $id . "';";
mysqli_query($db_connect, $sql);
}
if($sw ==30){
echo "again";
}
else if($sw !== "3") {
$sql = "SELECT * FROM addre WHERE addre.id = '" . $id . "';";
$result = mysqli_query($db_connect, $sql);
$record = mysqli_fetch_assoc($result);
echo $record["name"] . "," . $record["temperature_now"] . "," . $record["moist"] . "," .
$record["temperature_want"];
}
?>