title: Only the first SQL statement is being executed.Why is this?
body: <p>I am using the Slim PHP framework for my API. In this function, I have used two statements <code>$sql</code> and <code>$sql1</code> to execute two different queries. <code>$sql</code> is getting inserted successfully whereas <code>$sql1</code> is not. I am unable to debug this code.</p>
  
  <pre><code>&lt;?php
  use \Psr\Http\Message\ServerRequestInterface as Request;
  use \Psr\Http\Message\ResponseInterface as Response;
  
  $app-&gt;post('/insert/work_experience', function (Request $request, Response $response) {
  
  $user_id        = $_POST[0];
  $company_name   = $_POST[1];
  $start_date = $_POST[2];
  $end_date       = $_POST[3];
  $designation    = $_POST[4];
  $vertical       = $_POST[5];
  $skillstring    = $_POST[6];
  
  $skill = unserialize($skillstring); 
  
  $sql = "INSERT INTO work_experience (user_id, company_name, start_date, end_date, designation, vertical)
  VALUES (:user_id,:company_name,:start_date,:end_date,:designation,:vertical);";
  
  $sql1 = "INSERT INTO skills (user_id, start_date, end_date, skill)
  VALUES (:user_id,:start_date,:end_date,:skill);"; 
  
  try{
      //make db object
      $db = new db();
  
      //connection
      $db = $db-&gt;connect();
  
      $stmt = $db-&gt;prepare($sql);
  
      $stmt-&gt;bindParam(':user_id',        $user_id);
      $stmt-&gt;bindParam(':company_name',   $company_name);
      $stmt-&gt;bindParam(':start_date',     $start_date);
      $stmt-&gt;bindParam(':end_date',       $end_date);
      $stmt-&gt;bindParam(':designation',    $designation);
      $stmt-&gt;bindParam(':vertical',       $vertical);
  
      $stmt-&gt;execute();  //This statement is being executed successfully 
  
      $stmt1 = $db-&gt;prepare($sql1);
  
      $stmt1-&gt;bindParam(':user_id',       $user_id);
      $stmt1-&gt;bindParam(':start_date',    $start_date);
      $stmt1-&gt;bindParam(':end_date',      $end_date);
  
  
      $i=0;
      while($i&lt;count($skill)){
          $skill1 = $skill[$i];
          $stmt1-&gt;bindParam(':skill', $skill1);
          $i++;
          $stmt1-&gt;execute(); //This statement is not being executed
      }
  
      echo '{"notice": {"text": "Data Added"}'; 
  
  } catch(PDOException $e){
      echo '{"error": {"text": '.$e-&gt;getMessage().'}';
  } 
  </code></pre>
  
  <p>});</p>