I am using this code to connect to the database and that works but when I check the database it doesn't input anything. I'm pretty sure everything is right, the host, username, password, and database names are all correct but it's still not working or giving me an error code. It's just a blank page with connection successful. I'm trying to input a boolean value into my database.
write_data.php code:
<?php
write_data.php code:
<?php
// Connect to your database
$dbconnect = mysqli_connect("inkndiode.ml","epiz_22606208","0fhmtmz9Byz");
$dbselect = mysqli_select_db($dbconnect,"epiz_22606208_ti1");
// Prepare the SQL statement
$sql = "INSERT INTO epiz_22606208_ti1.sensor (value) VALUES ('".$_GET["value"]."')";
('".$_GET["temp"]."','".$_GET["humid"]."','".$_GET["soilmoi"]."')";
// Execute SQL statement
mysqli_query($dbconnect,$sql);
?>
------------------------------------------------------------------------------------------------
get_data.php:
------------------------------------------------------------------------------------------------
get_data.php:
<?php
$url=$_SERVER['REQUEST_URI'];
header("Refresh: 5; URL=$url"); // Refresh the webpage every 5 seconds
?>
Sensor data
PMS sensor readings
<?php
// Connect to database
// IMPORTANT: If you are using XAMPP you will have to enter your computer IP address here, if you are using webpage enter webpage address (ie. "www.yourwebpage.com")
$con=mysqli_connect("inkndiode.ml","epiz_22606208","0fhmtmz9Byz","epiz_22606208_ti1");
// Retrieve all records and display them
$result = mysqli_query($con,'SELECT * FROM sensor ORDER BY id DESC');
// Process every record
while($row = mysqli_fetch_array($result))
{
echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; }
// Close the connection
mysqli_close($con);
?>
ID | Timestamp | Value |
" . $row['id'] . " | " . $row['time'] . " | " . $row['value'] . " |