title: PHP Insert query retuning success but not inserting data to the table
body: <p>I'm having issues with insert queries on a database that I am porting my code over to. I have first of all had to change everything from mysqli to PDO which fixed every problem except for this one.</p>
  
  <p>I have tried using prepared statements, I have tried hardcoding the entry values. I have also verified that permissions are not the issue, plus that would return a fail I assume?</p>
  
  <p>This query always returns success on all entries but does not enter anything into the database, however I have an update query written in the same script if I find a row already there so I know the variables are being populated.</p>
  
  <p>I am at a loss for what could be causing the issue</p>
  
  <p>here is the code:</p>
  
  <pre><code>$currKey = 1;
  
               foreach ($answer as $a)
              {
                  $insertquery = "INSERT INTO table(userid, step_number, question_number, answer) VALUES ($userid, $stepNumber, $currKey, '$a')";
  
                  if (!$stmt = $db-&gt;query($insertquery))
                  {
                      $response = array();
                      $response["success"] = 0;
                      $response["message"] = "Error at insert query";
                  }
                  else
                  {
                      $response = array();
                      $response["success"] = 1;
                      $resppnse["message"] = "success";
  
                      $currKey += 1;
                  }
              }
  
  
              echo json_encode($response);
  </code></pre>