title: Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given
body: <p>Why am I getting this error message: </p>
  
  <blockquote>
    <p>Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given</p>
  </blockquote>
  
  <p>My code is:</p>
  
  <pre><code>$statement = "INSERT INTO table1 (data1, data2) VALUES ('$variable1', '$variable2')";
  
  if ($result = mysqli_query($conn,$statement)) {
  echo "New record added successfully";
            } else {
      echo "Error adding records: " . $result . "&lt;br&gt;" . mysqli_error($conn);
  }
  
  echo "Adding records finished. ";
  
  mysqli_free_result($result);
  </code></pre>