title: How to get multiple rows of data from mysql through JSON using Volley
body: <p>I am trying to get the output of my below mentioned php file into my android app through JSON but i am getting only the first entry in my android app.I tried doing the below steps as well i can but i am able to get only first output but rest of the output is Not visible in my app</p>
  
  <pre><code>&lt;?php 
      define('HOST','XXXX');
      define('USER','XXXX');
      define('PASS','XXXX');
      define('DB','XXXX'); 
      $con = mysqli_connect(HOST,USER,PASS,DB) or die('Unable to Connect'); 
      if($_SERVER['REQUEST_METHOD']=='GET'){ 
          $customerEmail = $_GET['customerEmail']; 
          $sql = "SELECT `amount`, `customerEmail`, `CCAvenueOrder_id` FROM `                 OrderAborted` WHERE customerEmail='".$customerEmail."'"; 
          $r = mysqli_query($con,$sql);
          while($res = mysqli_fetch_array($r))
          { 
              $result = array();
              array_push($result,array(
                              "customerEmail"=&gt;$res['customerEmail'],
                              "CCAvenueOrder_id"=&gt;$res['CCAvenueOrder_id'],
                              "amount"=&gt;$res['amount']
                              )
              );
              echo json_encode(array("result"=&gt;$result));
          }
          mysqli_close($con); 
      }
  ?&gt;
  </code></pre>
  
  <p>JSON code</p>
  
  <pre><code>     private void getData() {
      String id = editTextId.getText().toString().trim();
      if (id.equals("")) {
          Toast.makeText(this, "Please enter an id",         Toast.LENGTH_LONG).show();
          return;
      }
       loading = ProgressDialog.show(this,"Please wait...","Fetching...",false,false);
  
      String url = Constants.DATA_URL+editTextId.getText().toString().trim();
  
      StringRequest stringRequest = new StringRequest(url, new Response.Listener&lt;String&gt;() {
          @Override
          public void onResponse(String response) {
              loading.dismiss();
              showJSON(response);
          }
                 },
              new Response.ErrorListener() {
                  @Override
                  public void onErrorResponse(VolleyError error) {
                       Toast.makeText(OrderHistory.this,error.getMessage().toString(),Toast.LENGTH_LONG).show();
                  }
              });
  
      RequestQueue requestQueue = Volley.newRequestQueue(this);
      requestQueue.add(stringRequest);
  }
  
  private void showJSON(String response){
      String name="";
      String address="";
      String vc = "";
      try {
          JSONObject jsonObject = new JSONObject(response);
          JSONArray result = jsonObject.getJSONArray(Constants.JSON_ARRAY);
          JSONObject collegeData = result.getJSONObject(0);
          name = collegeData.getString(Constants.KEY_NAME);
          address = collegeData.getString(Constants.KEY_ADDRESS);
          vc = collegeData.getString(Constants.KEY_VC);
      } catch (JSONException e) {
          e.printStackTrace();
      }
       textViewResult.setText("Name:\t"+name+"\nAddress:\t" +address+ "\nVice        Chancellor:\t"+ vc);
     }
  </code></pre>