Created
June 4, 2023 17:24
-
-
Save AbhishekGhosh/1f4a78e57db34130fac6e351db682191 to your computer and use it in GitHub Desktop.
Insert data in MySQL tables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$servername = "localhost"; | |
$username = "non-root"; | |
$password = "non-root-password"; | |
$conn = new mysqli($servername, $username, $password, $dbname); | |
if ($conn->connect_error){ | |
die("Connection failed: " . $conn->connect_error); | |
} | |
$sql = "INSERT INTO LED_status (id, status) | |
VALUES ('1', '0')"; | |
if ($conn->query($sql) === TRUE) { | |
echo "New record created successfully"; | |
}else{ | |
echo "Error: " . $sql . "<br>" . $conn->error; | |
} | |
$conn->close(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment