title: Can not insert data into database prepared statemend using looping for
body: <p>Hy, i want to insert data into database using prepareStatement method, and it works normally, but when i insert data from loop for, data won't insert to db.
  Here's my code: </p>
  
  <pre><code>PreparedStatement stmts = connection.prepareStatement(
      "INSERT INTO detil_bet (id_user, id_room, id_game, bettype, total, win, lose) VALUES (?, ?, ?, ?, ?, ?, ? )"
  );
  stmts.setInt(1, Uid);
  stmts.setInt(2, idRoom);
  stmts.setInt(3, idg);
  int count = 0;
  int size = 10;
  String betsmall=""+0;
  String betbig = ""+1;
  String Z = "";
  for (int i = 0; i &lt; size; i++) {
      String[] b = {betsmall,betbig};
      count++;
      if(!b[i].equals(""+0)) {
          if(count &gt; 0) {
               Z += "; ";
          }
          Z += "S" + count + ":" + b[i];
          stmts.setString(4, Z);
      }
  }
  stmts.setInt(5, tobet);
        if(pay &gt;= tobet){
        stmts.setInt(6, pay - tobet);
        }else if (pay &lt;= tobet){
            stmts.setInt(6, 0);
        }
        if(tobet &gt;= pay){
            stmts.setInt(7, tot + (tot*-2));
        }
        else if (tobet &lt;= pay){
            stmts.setInt(7, 0);
        }
        stmts.executeUpdate();
  
      }
  </code></pre>
  
  <p>index 1,2 and 3 works fine, the problem is index number 4, it doesn't work</p>