[php] a
Viewer
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "eslolin";
- // Create connection
- $conn = mysqli_connect($servername, $username, $password, $dbname);
- // Check connection
- if (!$conn) {
- die("Koneksi gagal: " . mysqli_connect_error());
- }
- //Query data untuk mengambil nilai sensor dengan IdSensor = 1
- $sql = "SELECT * FROM uts order by idMeja";
- //$sql = "SELECT * FROM sensor";
- $result = mysqli_query($conn, $sql);
- if (mysqli_num_rows($result) > 0) {
- // output data of each row
- while ($row = mysqli_fetch_assoc($result)) {
- echo $row["statusMeja"] . ",";
- //echo $row["statusSensor"];
- }
- } else {
- echo "0 results";
- }
- mysqli_close($conn);
Editor
You can edit this paste and save as new: