Code has been added to clipboard!
MySQL Insert Into for MySQLi Users
Example
<?php
$servername = 'localhost';
$username = 'name_of_the_user';
$password = 'users_password';
$dbname = 'myDatabase';
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error)Â {
die("Connection went wrong: " . $conn->connect_error);
}
$sql = "INSERT INTO MovieList (title, rating, price) VALUES ('random_movie', 'good', '5')";
if ($conn->query($sql) === TRUE) {Â Â Â
echo "Inserted successfully";
} else {Â Â Â
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>