title: Json arrays save in sql
body: <p>I need to save Json arrays into sql database.  This is example. What is wrong in this code.</p>
  
  <pre><code>               {
                  "product": [
                 {
                   "money": "60",
                   "sum": "120"
                  },
                  {
                    "money": "50",
                    "sum": "100"
                  }
                ]
               }
  
  $json = json_decode($_POST['x'], TRUE);
  $counter  = count($json['product']); 
  
  for($i=0; $i&lt;$counter; $i++){
  $query = mysqli_query($db,"INSERT INTO table2 (money,sum) VALUES ('".$json['product'][$i]['money']."', '" .$json['product'][$i]['sum']."')");
        } 
  </code></pre>