title: Why the following PHP code is not inserting the values in the database?
body: <p>I want to insert the values of a form into the database table called company. But this program again and again tells me that my query did not get executed. May I know why this is so??</p>
  
  <p>I have stored all the values of the form into an array called insert and than I implode the array and name it as newarray so that it is in a form which can be inserted into the database.</p>
  
  <p>But this does not seem to work for me. Please tell me what's the problem in here??  </p>
  
  <pre><code>&lt;?php
  $host = "localhost";
  $name = "root";
  $password = "";
  $db = "shopinz";
  $con = mysqli_connect($host,$name,$password,$db);
  $insert = array();
  $newarray = array();
  if(mysqli_connect_errno()){
      echo("Cannot connect to the databse".mysqli_connect_errno());
      exit();
  }
  else{
      if($_SERVER['REQUEST_METHOD'] == 'POST'){
          foreach($_POST as $value){
              if($value == $_POST['submit']){
                  break;
              } 
              else{
                      array_push($GLOBALS['insert'],$value);
              }
          }
           $newarray = implode(',',$insert);
           $result = mysqli_query($con,"INSERT INTO company (company_name,company_number,company_address) VALUES($newarray)");
           if($result){
               echo("1 row added");
           }
           else{
               echo("Query not executed");
           }
       }
   }
   ?&gt;
  </code></pre>