title: Retrieve specific data from database and display
body: <p>How to retrieve specific data from database and display?</p>
  
  <pre><code>    String sql = "Select Product_ID,Order_Quantity,Sub_Total from Order_Menu Where Order_ID='"+order_id_1+"'";
      pst = conn.prepareStatement(sql);
      rs = pst.executeQuery();
  
      while(rs.next()){
  
          list.add(rs.getString("Product_ID"));
          list.add(rs.getString("Order_Quantity"));
          list.add(rs.getString("Sub_Total"));
  
          for(int i = 0;i&lt;list.size();i++){
              String item = list.get(i);
              System.out.println("Item" + i + ":" + item);
          }
  </code></pre>
  
  <p>I define the array </p>
  
  <pre><code>ArrayList &lt;String&gt; list = new ArrayList&lt;String&gt;();
  </code></pre>
  
  <p>my output</p>
  
  <pre><code>Item0:P0001  
  Item1:1  
  Item2:37.0
  Item0:P0001 
  Item1:1 
  Item2:37.0
  Item3:P0002 
  Item4:2 
  Item5:666.0
  </code></pre>
  
  <p>My database only contains 2 items which is P0001 and P0002, how come the result will display 1 more item  
  Sorry, I'm slightly confuse about array</p>