title: How to retrieve mysql data using a unique key value?
body: <p>I am trying to retrieve user data with the help of user's email id from mysql database using php script. But i can't retrieve the json. </p>
  
  <p>Here I am attaching my code as well as php script.
  Help me to solve this problem.</p>
  
  <pre><code>protected String doInBackground(String... params) {
              String JSON_STRING;
  
              try {
                  String user_email = params[0];
                  URL url = new URL(get_json);
                  HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
                  httpURLConnection.setRequestMethod("POST");
                  httpURLConnection.setDoOutput(true);
                  OutputStream os = httpURLConnection.getOutputStream();
                  BufferedWriter bufferwriter = new BufferedWriter(new OutputStreamWriter(os,"UTF-8"));
                  String data = URLEncoder.encode("user_email", "UTF-8")+"="+URLEncoder.encode(user_email,"UTF-8");
  
                  bufferwriter.write(data);
                  bufferwriter.flush();
                  bufferwriter.close();
                  os.close();
  
  
                  InputStream inputStream = httpURLConnection.getInputStream();
                  BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
                  StringBuilder stringBuilder = new StringBuilder();
  
                  while ((JSON_STRING = bufferedReader.readLine()) != null) {
                      stringBuilder.append(JSON_STRING + "\n");
                  }
  
                  bufferedReader.close();
                  inputStream.close();
                  httpURLConnection.disconnect();
                  return stringBuilder.toString().trim();
  
              } catch (MalformedURLException e) {
                  e.printStackTrace();
              } catch (IOException e) {
                  e.printStackTrace();
              }
  </code></pre>
  
  <p>PHP Code:</p>
  
  <pre><code>&lt;?php
  
  
  $db_name="society_management";
  $mysql_user="root";
  $mysql_pass="";
  $server_name="localhost";
  
  $con=mysqli_connect($server_name,$mysql_user,$mysql_pass,$db_name);
  
  
  
  
  $mail=$_POST["user_email"];
  
  
  
  $sql = "select * from member where e-mail='$mail';";
  
  
  $res = mysqli_query($con,$sql);
  $response = array();
  while($row=mysqli_fetch_array($res))
  {
  array_push($response,$row[0],$row[1],$row[2],$row[3],$row[4],$row[5]);
  }
  echo json_encode(array('result'=&gt;$response));
  echo "hey " .$mail;
  mysqli_close($con); 
  
  ?&gt;
  </code></pre>