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();  
?>