[php] uts_iot
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
- <?php
- // Konfigurasi database
- $servername = "localhost"; // Ganti dengan nama server Anda jika berbeda
- $username = "root"; // Ganti dengan username database Anda
- $password = ""; // Ganti dengan password database Anda
- $dbname = "iot";
- // Buat koneksi ke database
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Periksa koneksi
- if ($conn->connect_error) {
- die("Koneksi gagal: " . $conn->connect_error);
- }
- // Ambil data dari NodeMCU
- if (isset($_GET['kursi']) && isset($_GET['status'])) {
- $kursi = $_GET['kursi'];
- $status = $_GET['status'];
- // Update status_kursi dan jumlah_nyala berdasarkan data dari NodeMCU
- $sql = "UPDATE utss SET status_kursi=$status, jumlah_nyala=jumlah_nyala+1 WHERE id=$kursi";
- if ($conn->query($sql) === TRUE) {
- echo "Data berhasil disimpan";
- } else {
- echo "Error: " . $sql . "<br>" . $conn->error;
- }
- }
- $conn->close();
Editor
You can edit this paste and save as new:
File Description
- uts_iot
- Paste Code
- 28 Apr-2024
- 945 Bytes
You can Share it: