title: Select data from MySQL using android volley post request and display it in recyclerview
body: <p>What I want is that when someone(user) click's a button on main activity two values will be send to the php file with the help of volley POST request, say minvalue and maxvalue, and it will select the data accordingly from mysql database.</p>
  
  <p>Here's my code for POST request:</p>
  
  <pre><code>public void FilterPower(View view) {
  
      StringRequest stringRequest = new StringRequest(Request.Method.POST, Config.DATA_URL,
              new Response.Listener&lt;String&gt;() {
                  @Override
                  public void onResponse(String response) {
  
                      /*Some Method*/
                      /*Display data in recyclerview*/
  
                      //Initializing Views
                      recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
                      recyclerView.setHasFixedSize(true);
                      layoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
                      recyclerView.setLayoutManager(layoutManager);
  
                      //Initializing our superheroes list
                      listSuperHeroes = new ArrayList&lt;&gt;();
  
                      //Calling method to get data
                      getData();
  
                      /*End Display data in recyclerview*/
                      /*End Some Method*/
  
                  }
              },
              new Response.ErrorListener() {
                  @Override
                  public void onErrorResponse(VolleyError error) {
                      Toast.makeText(MainActivity.this, error.toString(), Toast.LENGTH_LONG).show();
                  }
              }) {
  
          @Override
          protected Map&lt;String,String&gt; getParams() {
              Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
  
              params.put("minvalue", "1000");
              params.put("maxvalue", "2000");
              return params;
          }
  
      };
  
      RequestQueue requestQueue = Volley.newRequestQueue(MainActivity.this);
      requestQueue.add(stringRequest);
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>My Php File Code:</p>
  
  <pre><code>&lt;?php
  
  $con = mysqli_connect("127.0.0.1","superinfoadmin","","superhero");
  if (!$con)
  {
      die('Could not connect: ' . mysql_error());
  }
  
  if($_SERVER['REQUEST_METHOD']=='POST'){
  
  $minvalue       = $_POST['minvalue'];
  $maxvalue       = $_POST['maxvalue'];
  
  $result = mysqli_query($con, "SELECT * FROM superinfo, publisher WHERE superinfo.s_publisherid=publisher.p_id AND (s_power BETWEEN $minvalue AND $maxvalue)");
  
  //$result = mysqli_query($con, "INSERT INTO testDB (min, max) VALUES ('$minvalue', '$maxvalue')");
  
  while($row = mysqli_fetch_assoc($result))
  {
      $output[]=$row;
  }
  print(json_encode($output));
  
  mysqli_close($con);
  
  }
  ?&gt;
  </code></pre>
  
  <p>When I try running my app using above code no data is selected and displayed in recyclerview.</p>
  
  <p>But when I try Inserting values in the database using same variable then the values are inserted.</p>
  
  <p>I even tried keeping both select and insert statement to check whether it enters the "IF" loop, and yes it does enters and insert the values in DB but does not executes select statement.</p>
  
  <p>However if I give an else statement to select all data and display it in recyclerview it works properly, so there's no problem in displaying the data in recyclerview the code works fine. Below is the same PHP code with else statement:</p>
  
  <pre><code>if($_SERVER['REQUEST_METHOD']=='POST'){
  
  $minvalue       = $_POST['minvalue'];
  $maxvalue       = $_POST['maxvalue'];
  
  $result = mysqli_query($con, "SELECT * FROM superinfo, publisher WHERE superinfo.s_publisherid=publisher.p_id AND (s_power BETWEEN $minvalue AND $maxvalue)");
  
  //$result = mysqli_query($con, "INSERT INTO testDB (min, max) VALUES ('$minvalue', '$maxvalue')");
  
  while($row = mysqli_fetch_assoc($result))
  {
      $output[]=$row;
  }
  print(json_encode($output));
  
  mysqli_close($con);
  
  }
  else{
  
  $result = mysqli_query($con, "SELECT * FROM superinfo, publisher WHERE superinfo.s_publisherid=publisher.p_id");
  
  while($row = mysqli_fetch_assoc($result))
  {
      $output[]=$row;
  }
  print(json_encode($output));
  
  mysqli_close($con);
  }
  </code></pre>
  
  <p>Please Help I don't know what I'm doing wrong or what I'm not doing.</p>