title: NodeJS Json Data not fully inserting into database
body: <p>Been 2 days trying to find a solution to my problem.
  I request data(json) from a website.
  They return fine and json is valid but when i try to insert them to database almost 10% do not get inserted.
  I dont know what to do, i even tried php with same results.
  Any help world be appreciated thank you.</p>
  
  <p>This is json ouptut after selecting the data attribute var result = obj.data; <a href="https://pastebin.com/4gPi6n6Z" rel="nofollow noreferrer">pastebin</a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var request = require("request");
  var fs = require('fs');
  var sleep = require('system-sleep');
  
  var mysql = require('mysql');
  var connection = mysql.createConnection({
      host: 'localhost',
      user: 'root',
      password: '',
      database: 'feeds',
      timezone: 'Z'
  });
  
  request.post({
      url: "xxx",
      headers: {
          "Content-Type": "application/json"
      },
      body: '{"xx": "true", "xxx": "true"}'
  }, function(error, response, body) {
  
      var obj = JSON.parse(body);
      var result = obj.data;
      console.log(result);
      for (var i = 0; i &lt; result.length; i++) {
          var object = result[i];
          for (property in object) {
              var value = object[property];
              var pid, pname;
              if (property == "id") {
                  pid = value;
              }
              if (property == "name") {
                  pname = value;
              }
              if (property == "xxxxx") {}
              if (property == "xxxxxxxx") {
                  connection.query('INSERT INTO tournaments(id, name) VALUES (' + pid + ', "' + pname + '")');
              }
  
          }
      }
  
  });</code></pre>
  </div>
  </div>
  </p>