title: Same data from listview being printed multiple times
body: <p>This is my java activity.The data is being retrieve from server. Based on the <code>System.out.println("hi" +co.transaction_id)</code>, the same item is being printed 5 times. Is it my java problem or is it php problem. I have try to edit my listview xml height to match parent or fill parent but it doesn't help.</p>
  
  <pre><code>public class connect4 extends AsyncTask&lt;String, Void, String&gt; {
  // public static final String product_id = "product_id";
  public static final String RECEIPT_INDEX = "RECEIPT_INDEX";
  View view;
  Activity activity;
  ProductAdapter1 Adapter;
  public List&lt;ContactObject&gt; receipt = new ArrayList&lt;&gt;();
  
  
  Bitmap bitmap;
  
  public connect4(Activity activity, View v, ProductAdapter1 A) {
      this.activity = activity;
      view = v;
      Adapter = A;
  }
  
  String convertStreamToString(InputStream is) {
      try {
          return new java.util.Scanner(is).useDelimiter("\\A").next();
      } catch (java.util.NoSuchElementException e) {
          return "";
      }
  }
  protected String doInBackground(String... arg0) {
      String ipAddress = "http://10.207.140.22/apexStore2/";
      try {
          URL url = new URL(ipAddress +"receipt.php");
          String urlParameters =
                  URLEncoder.encode("user_id", "UTF-8") + "=" + 
    URLEncoder.encode(arg0[0], "UTF-8") + "&amp;" +
                          URLEncoder.encode("shipping_name", "UTF-8") + "=" + 
    URLEncoder.encode("???", "UTF-8") + "&amp;" +
                          URLEncoder.encode("shipping_address", "UTF-8") + "="
   + URLEncoder.encode("???", "UTF-8")+ "&amp;" +
                          URLEncoder.encode("shipping_contact", "UTF-8") + "=" 
   + URLEncoder.encode("???", "UTF-8")+ "&amp;" +
                          URLEncoder.encode("shipping_email", "UTF-8") + "=" + 
   URLEncoder.encode("???", "UTF-8")+ "&amp;" +
                          URLEncoder.encode("order_date", "UTF-8") + "=" + 
   URLEncoder.encode("???", "UTF-8")+ "&amp;" +
                          URLEncoder.encode("trx_id", "UTF-8") + "=" + 
   URLEncoder.encode("???", "UTF-8")+ "&amp;" +
                          URLEncoder.encode("tracking_num", "UTF-8") + "=" +
   URLEncoder.encode("???", "UTF-8")+ "&amp;" +
                          URLEncoder.encode("quantity", "UTF-8") + "=" + 
   URLEncoder.encode("???", "UTF-8")+ "&amp;" +
                          URLEncoder.encode("product_id", "UTF-8") + "=" + 
    URLEncoder.encode("???", "UTF-8")+ "&amp;" +
                          URLEncoder.encode("product_title", "UTF-8") + "=" + 
   URLEncoder.encode("???", "UTF-8")+ "&amp;" +
                          URLEncoder.encode("product_price", "UTF-8") + "=" + 
    URLEncoder.encode("???", "UTF-8")+ "&amp;" +
                          URLEncoder.encode("product_img1", "UTF-8") + "=" + 
    URLEncoder.encode("???", "UTF-8");
  
          HttpURLConnection connection = (HttpURLConnection) 
     url.openConnection();
  
          connection.setRequestMethod("POST");
          connection.setRequestProperty("Content-Type",
                  "application/x-www-form-urlencoded");
  
          connection.setRequestProperty("Content-Length", "" +
                  Integer.toString(urlParameters.getBytes().length));
          connection.setRequestProperty("Content-Language", "en-US");
  
          connection.setUseCaches(false);
          connection.setDoInput(true);
          connection.setDoOutput(true);
  
          //Send request
          DataOutputStream wr = new DataOutputStream (
                  connection.getOutputStream ());
          wr.writeBytes (urlParameters);
          wr.flush ();
          wr.close ();
  
          //Get Response
          InputStream is = connection.getInputStream();
          BufferedReader rd = new BufferedReader(new InputStreamReader(is));
          String line;
          StringBuffer response = new StringBuffer();
          while((line = rd.readLine()) != null) {
              response.append(line);
              response.append('\r');
          }
          rd.close();
          //System.out.println(response.toString());
  
          JSONObject mainObject = new JSONObject(response.toString());
          JSONArray uniObject = mainObject.getJSONArray("result");
          for(int i = 0; i &lt; uniObject.length(); i++) {
              ContactObject co = new ContactObject();
              JSONObject rowObject = uniObject.getJSONObject(i);
              //EventObject co = new EventObject();
              //co.user_id = rowObject.getString("user_id");
              co.name = rowObject.getString("shipping_name");
              co.address = rowObject.getString("shipping_address");
              co.contact = rowObject.getString("shipping_contact");
              co.email = rowObject.getString("shipping_email");
              co.orderdate = rowObject.getString("order_date");
              co.transaction_id = rowObject.getString("trx_id");
              co.tracking_id = rowObject.getString("tracking_num");
              co.quantity = rowObject.getString("quantity");
              co.product_id = rowObject.getString("product_id");
              co.product_title = rowObject.getString("product_title");
              co.product_price = rowObject.getString("product_price");
              co.img1 = ipAddress +"img/products/" + 
  rowObject.getString("product_img1");
              //mContentItems.add(co);
              System.out.println("hi" +co.transaction_id);
              receipt.add(new ContactObject(co.name, co.address, co.contact, 
  co.email, co.orderdate, co.transaction_id, co.tracking_id, co.quantity, 
  co.product_id, co.product_title, co.product_price, co.img1));
              //         userLogin(co.product_id);
          }
  
          //To further break down JSON
          //JSONObject oneObject = mainObject.getJSONObject("1");
          //String id = oneObject.getJSONObject("id");
          try{
  
          }
          finally{
              connection.disconnect();
          }
      } catch (Exception e){
          System.out.println(e.toString());
      }
      return "";
  }
  
  protected void onPreExecute(){
  
  }
  
  @Override
  protected void onPostExecute(String result){
      Adapter.receipt = receipt;
      Adapter.notifyDataSetChanged();
  }
  
  
  
  private class LoadImage extends AsyncTask&lt;String, String, Bitmap&gt; {
      ImageView img;
      public LoadImage(ImageView img){
          this.img = img;
      }
  
      @Override
      protected void onPreExecute() {
          super.onPreExecute();
  
      }
      protected Bitmap doInBackground(String... args) {
          try {
              bitmap = BitmapFactory.decodeStream((InputStream) new 
  URL(args[0]).getContent());
  
          } catch (Exception e) {
              e.printStackTrace();
          }
          return bitmap;
      }
  
      protected void onPostExecute(Bitmap image) {
  
          if(image != null){
              img.setImageBitmap(image);
          }else{
          }
      }
  }
  }
  </code></pre>
  
  <p>This is my php script.</p>
  
  <pre><code>&lt;?php
   include ('classes/functions.php');
  
   if(isset($_POST['user_id'])){
  $user_id = $_POST['user_id'];
  $check_receipt = "select  si.shipping_name,
      si.shipping_address,
      si.shipping_contact,
      si.shipping_email,
      o.order_date,
      o.trx_id,
      o.tracking_num,
      o.quantity,
      o.product_id,
      p.product_title,
      p.product_price,
      p.product_img1
   from shipping_infos si
   inner join orders o
   on si.user_id = o.user_id inner join products p on p.product_id =    
   o.product_id   
   where si.user_id='".$user_id."';";
  
          $run_receipt_checking = mysqli_query($con, $check_receipt);
          $result = array();
      while($row = mysqli_fetch_array($run_receipt_checking)){
      array_push($result,
      array(
            'shipping_name'=&gt;$row[0],
            'shipping_address'=&gt;$row[1],
            'shipping_contact'=&gt;$row[2],
            'shipping_email'=&gt;$row[3],
            'order_date'=&gt;$row[4],
            'trx_id'=&gt;$row[5],
            'tracking_num'=&gt;$row[6],  
            'quantity'=&gt;$row[7],
            'product_id'=&gt;$row[8],
            'product_title'=&gt;$row[9],           
            'product_price'=&gt;$row[10],
            'product_img1'=&gt;$row[11]            
  
  ));
  }
  echo json_encode(array("result"=&gt;$result));
   }
  ?&gt;
  </code></pre>