Skip to content

Instantly share code, notes, and snippets.

@AbhishekGhosh
Created June 4, 2023 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AbhishekGhosh/1f4a78e57db34130fac6e351db682191 to your computer and use it in GitHub Desktop.
Save AbhishekGhosh/1f4a78e57db34130fac6e351db682191 to your computer and use it in GitHub Desktop.
Insert data in MySQL tables
<?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