title: Inserting data into a MYSQL database
body: <p>I am having trouble inserting data into the database 'justrated'. Once the user has entered their business name it should create a new entry in the table 'businesses'. For some reason I cannot get it so that the data is entered in the table. Any advice is gladly appreciated.</p>
  
  <p>CODE:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Test&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form&gt;
  
  &lt;input type="text" name="BusinessName" method="POST"&gt;
  &lt;input type="Submit" value="submit" name="submit" method="POST"&gt;
  
  &lt;/form&gt;
  
  &lt;?php
  
  
  if (isset($_POST["submit"])){
      //create connection
      $conn = new mysqli("localhost", "root", "", "justrated");
      // Check connection
      if ($conn-&gt;connect_error) {
          die("Connection failed: " . $conn-&gt;connect_error);
      }
  
      $sql = "INSERT INTO businesses (BusinessName)
  VALUES ('".$_POST['BusinessName']."' )";
      mysql_query($sql);
      if ($conn-&gt;query($sql) === TRUE) {
          echo "New record created successfully";
      } else {
          echo "Error: " . $sql . "&lt;br&gt;" . $conn-&gt;error;
      }
  
      $conn-&gt;close();
  }
  
  ?&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>