title: Not logging in? No value for login error?
body: <p>the api login.php is correct but some problem in java code in android studio but not understanding the problem?need help in code?</p>
  
  <p>I have tried my method but it dosen't solve my problem.</p>
  
  <p>this is my login.php code.</p>
  
  <pre><code>header("Access-Control-Allow-Origin: *");
  header("Access-Control-Allow-Methods: POST");
  header("Content-Type: application/json; charset=UTF-8");
  require_once 'uconnection.php';
  
  $data = json_decode(file_get_contents("php://input"));
  
  if (!$data) {
      $result['success'] = "0";
      $result['message'] = "Login payload missing. Send email and password in the request header.";
      echo json_encode($result);
  
      mysqli_close($conn);
  } else {
      if ($_SERVER['REQUEST_METHOD'] == 'POST') {
          $email = $data-&gt;email;
          $password = $data-&gt;password;
          if ($email != null &amp;&amp; $password != null) {
              $sql = "SELECT * FROM user WHERE email='" . $email . "' AND password='" . $password . "' ";
  
              $response = mysqli_query($conn, $sql);
  
              // var_dump($response);
              // echo $response-&gt;num_rows;
              // echo "--";
              // echo mysqli_num_rows($response);
              // echo "--";
  
              $result = array();
              $result['login'] = array();
  
              // echo "OUTSIDE";
              if (mysqli_num_rows($response) &gt; 0) {
  
                  // echo "Found";
  
                  $row = mysqli_fetch_assoc($response);
                  print_r($row);
                  // echo $row["password"];
  
                  if ($email == $row["email"] &amp;&amp; $password == $row["password"]) {
  
                      // echo "VERIFIED";
  
                      $index['firstname'] = $row['firstname'];
                      $index['email'] = $row['email'];
                      $index['id'] = $row['id'];
  
                      array_push($result['login'], $index);
  
                      $result['success'] = "1";
                      $result['message'] = "success";
                      echo json_encode($result);
  
                      mysqli_close($conn);
  
                  } else {
  
                      $result['success'] = "0";
                      $result['message'] = "error";
                      echo json_encode($result);
  
                      mysqli_close($conn);
  
                  }
              } else {
                  $result['success'] = "0";
                  $result['message'] = "Incorrect username and/or password";
                  echo json_encode($result);
  
                  mysqli_close($conn);
  
              }
          } else {
              if ($email == null) {
                  $result['success'] = "0";
                  $result['message'] = "email missing";
                  echo json_encode($result);
  
                  mysqli_close($conn);
              }
  
              if ($password == null) {
                  $result['success'] = "0";
                  $result['message'] = "password missing";
                  echo json_encode($result);
  
                  mysqli_close($conn);
              }
          }
      } else {
          $result['success'] = "0";
          $result['message'] = "only POST request possbile";
          echo json_encode($result);
  
          mysqli_close($conn);
      }
  }
  </code></pre>
  
  <p>And this is android java login class code.</p>
  
  <pre><code>private EditText emailid,password;
      private Button buttonlogin,buttonregister1;
      private ProgressDialog pDialog;
      String emailid_login, password_login;
  
      private static String URL_LOGIN = "http://192.168.68.74:80/loginregistervollyphp/login.php";
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_login);
  
          emailid = findViewById(R.id.etxt_email);
          password = findViewById(R.id.etxt_password);
          buttonlogin = findViewById(R.id.btn_login);
          buttonregister1 = findViewById(R.id.btn_register);
  
          buttonregister1.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Intent i1 = new Intent(LoginActivity.this, MainActivity.class);
                  startActivity(i1);
                  finish();
              }
          });
  
          buttonlogin.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  emailid_login = emailid.getText().toString().trim();
                  password_login = password.getText().toString().trim();
  
                  if (!emailid_login.isEmpty() &amp;&amp; !password_login.isEmpty()){
                      login(emailid_login,password_login);
                  }
                  else {
                      emailid.setError("Please insert Email id");
                      password.setError("Please insert Password");
                  }
              }
          });
      }
  
      private void displayLoader() {
          pDialog = new ProgressDialog(LoginActivity.this);
          pDialog.setMessage("Loging In... Please wait...");
          pDialog.setIndeterminate(false);
          pDialog.setCancelable(false);
          pDialog.show();
  
      }
  
      private void login(final String email, final String password){
          displayLoader();
  
          StringRequest stringRequest = new StringRequest(Request.Method.POST,URL_LOGIN,
          new Response.Listener&lt;String&gt;() {
              @Override
              public void onResponse(String response) {
                  pDialog.dismiss();
                  try {
                      JSONObject jsonObject = new JSONObject(response);
                      String success = jsonObject.getString("success");
                      JSONArray jsonArray = jsonObject.getJSONArray("login");
                      Log.d("LOGINSUCCESS", String.valueOf(jsonObject));
  
                      if (!success.equals("0")){
  
                              String email2 = jsonObject.getString("email").trim();
                              String fname = jsonObject.getString("firstname").trim();
  
                              Intent intent = new Intent(LoginActivity.this,UserDashboard.class);
                              intent.putExtra("email",email2);
                              intent.putExtra("firstname",fname);
                              startActivity(intent);
                      }else if (success.equals("0")){
                          Toast.makeText(LoginActivity.this, "Error! Logging In", Toast.LENGTH_SHORT).show();
                      }
  
                  } catch (JSONException e) {
                      e.printStackTrace();
                      Toast.makeText(LoginActivity.this, "Error Loging in: "+e.toString(), Toast.LENGTH_SHORT).show();
                  }
  
              }
          },
                  new Response.ErrorListener() {
                      @Override
                      public void onErrorResponse(VolleyError error) {
                          pDialog.dismiss();
                          Toast.makeText(LoginActivity.this, "Error Loging in: "
                                  +error.toString(), Toast.LENGTH_SHORT).show();
                      }
                  })
          {
              @Override
              protected Map&lt;String, String&gt; getParams() throws AuthFailureError {
                  Map&lt;String, String&gt; params = new HashMap&lt;&gt;();
                  params.put("email",email);
                  params.put("password",password);
                  return params;
              }
          };
          RequestQueue requestQueue = Volley.newRequestQueue(this);
          requestQueue.add(stringRequest);
  
      }
  </code></pre>