title: Mysqli Insert Command not Working
body: <p>I have a database named "kargo" and a table named "cargos". I tried the code below but the data from the <code>POST</code> are not added to the "cargos" table. The connection is fine and returns no errors. What can I do?</p>
  
  <pre><code>&lt;?php include("functions.php"); get_header(); ?&gt;
  &lt;div id="content"&gt;
  &lt;?php $mysqli = new mysqli('localhost','root','','kargo');
  $name = $_POST['c_name'];
  $c_texit = $_POST['c_texit'];
  $c_tarrive = $_POST['c_tarrive'];
  $target = "kargo/";
  $target_file = $_FILES["cpic"]["tmp_name"];
  $target_move = $target.$_FILES["cpic"]["name"];
  $uploadOk = 1 ;
  
  if (file_exists($target_move)) {
  $uploadOk = 0; } 
  
  if($uploadOk == 1 ) {
  $query = $mysqli-&gt;query("INSERT INTO cargos 
  VALUES(NULL,'".$name."','".$c_texit."','".$c_tarrive."','".$target_move."')");
  move_uploaded_file($target_file,$target_move);
  echo "Cargo added."; header( "refresh:5;url=panel.php" ); }
  else { echo "-"; header( "refresh:5;url=panel.php" ); } ?&gt;
  &lt;/div&gt;
  &lt;?php get_footer(); ?&gt;
  </code></pre>