<?php
$conn = mysqli_connect("localhost","root","","toggle");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
exit();
}
$sql="SELECT state FROM esp ORDER BY no DESC LIMIT 1";
$result = mysqli_query($conn,$sql);
?>
<!DOCTYPE html>
<html>
<head>
<style>
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
.switch input