title: HTTPEntity Giving a null value
body: <p>I have a forgot password page on my Android app. If I enter in no email it returns the correct response from the server, and if I enter in an email that is found in our database then it sends the user an email and returns the correct response from the server. However if I enter in an email and it is not found in our database, when I call</p>
  
  <pre><code>HttpEntity entity = response.getEntity();
  </code></pre>
  
  <p>entity is a null value. I'm not sure why it would work for 2 of the cases but not the third.</p>
  
  <p>Does anyone know why that would be? My code is as follows</p>
  
  <p>Android Code:</p>
  
  <pre><code>private void accessURL(String url) {
      HttpClient httpclient = new DefaultHttpClient();
      HttpPost httppost = new HttpPost(url);
  
      if (url.equalsIgnoreCase(Global.forgotPasswordURL)) {
          InputStream is = null;
          ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;();
          nameValuePairs.add(new BasicNameValuePair("email", email.getText().toString()));
  
          try {
              httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
              HttpResponse response = httpclient.execute(httppost);
              HttpEntity entity = response.getEntity();
  
              if(entity != null){
                  is = entity.getContent();
                  String jsonResult = inputStreamToString(is).toString();
                  if (jsonResult.equalsIgnoreCase("Please enter your Email")) {
                      new AlertDialog.Builder(this).setTitle("Please Enter Your Email Address")
                              .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                                  public void onClick(DialogInterface dialog, int which) {
                                      // continue with delete
                                  }
                              }).show();
                  }else if(jsonResult.equalsIgnoreCase("Email Address Not Found")){
                      new AlertDialog.Builder(this).setTitle("The Email Address You Entered has not Been Found").setMessage("Make sure that you entered your email correctly.")
                      .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                          public void onClick(DialogInterface dialog, int which) {
  
                          }
                      }).show();
                  }else{
                      new AlertDialog.Builder(this).setTitle("Your Email Has Been Found!").setMessage("Check the email you provied for further instructions on resetting your password.")
                      .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                          public void onClick(DialogInterface dialog, int which) {
  
                          }
                      }).show();
                  }
              }else{
                  Log.d("Null", "null");
              }
  
          } catch (ClientProtocolException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>PHP Code:</p>
  
  <pre><code>if (isset($_POST["email"]) &amp;&amp; !empty($_POST['email'])) {
          $con=mysqli_connect("localhost","***********","******","*******");
          $email = $_POST['email'];
          $query = mysql_query("SELECT * FROM users WHERE email = '$email'");
          $query2 = mysql_query("SELECT * FROM tempusers WHERE email = '$email'");
          $ans = mysql_num_rows($query);
          $ans2 = mysql_num_rows($query2);
          $str = $ans . " " . $ans2;
          if(mysql_num_rows($query) == 0 &amp;&amp; mysql_num_rows($query2) == 0){
              sendResponse(205, "Email Address Not Found");
              return false;
          }
          $temp = false;
          if(mysql_num_rows($query2) != 0){
              $temp = true;
              $query1 = mysql_query("SELECT * FROM tempusers WHERE email = '$email'");
              $row = mysql_fetch_array($query1);
              mailUser($email, $row['firstname'], $temp);
  
              sendResponse(200, "Email Address Found".$str);
              return true;
          }else{
              $query1 = mysql_query("SELECT * FROM users WHERE email = '$email'");
              $row = mysql_fetch_array($query1);
              mailUser($email, $row['firstname'], $temp);
  
              sendResponse(200, "Email Address Found".$str);
              return true;
          }
      }
      sendResponse(400, 'Please enter your Email');
      return false;
  </code></pre>
  
  <p>Any help fixing this would be greatly appreciated, thanks!</p>