title: Basic PHP/MYSQL debugging
body: <p>I'm still new to php and this is what I've come up with after looking at many tutorials online. I have a basic submit form and I just want to store the data in the database. When I submit it and I check my database, there's nothing there.</p>
  
  <pre><code>&lt;form action="insert.php" method="post"&gt;     
  Value1: &lt;input type="text" name="field1-name" /&gt;
  
  &lt;input type="Submit" /&gt;&lt;/form&gt;
  </code></pre>
  
  <p>And the php file:</p>
  
  <pre><code>&lt;?php 
  $servername = "xxx";
  $username = "xxx";
  $password = "xxx";
  $dbname = "db";
  $conn = new mysqli($servername, $username, $password, $dbname);
  if ($conn-&gt;connect_error) {
      die("Connection failed: " . $conn-&gt;connect_error);
  
  $field1-name =  mysqli_real_escape_string ( $conn , $_POST['field1-name'])
  
  $sql = "INSERT INTO db (APP_NAME)
  VALUES ('$field1-name')";
  
  if ($conn-&gt;query($sql) === TRUE) {
      echo "OK";
  } else {
      echo "Error: " . $sql . "&lt;br&gt;" . $conn-&gt;error;
  }
  
  $conn-&gt;close();
  }
  ?&gt;
  </code></pre>