无法将java.lang.String转换为JSONObject 2

无法将java.lang.String转换为JSONObject 2,java,php,json,Java,Php,Json,我想用电子邮件和密码登录数据库并获取信息。我不知道我的问题是什么,因为当单击“登录”按钮时, 什么也看不出来。错误是: *org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject*. Button SignIn = (Button) findViewById(R.id.btn_signIn); final EditText etEmail = (EditTex

我想用电子邮件和密码登录数据库并获取信息。我不知道我的问题是什么,因为当单击“登录”按钮时, 什么也看不出来。错误是:

*org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject*. 
Button SignIn = (Button) findViewById(R.id.btn_signIn);
final EditText etEmail = (EditText) findViewById(R.id.etMail);
final EditText etPassword = (EditText) findViewById(R.id.etPassword);

SignIn.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        email = etEmail.getText().toString();
        password = etPassword.getText().toString();

        Response.Listener<String> responseListener = new Response.Listener<String>() {
            @Override
            public void onResponse(String response) {
                try {
                    JSONObject jsonResponse = new JSONObject(response);
                    boolean success = jsonResponse.getBoolean("success");

                    if (success) {
                        String name = jsonResponse.getString("name");
                        String surname = jsonResponse.getString("surname");

                        Intent intent = new Intent(LoginActivity.this, UsersMainActivity.class);
                        intent.putExtra("name", name);

                        LoginActivity.this.startActivity(intent);
                    } else {
                        AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this);
                        builder.setMessage("Login Failed Please Try again")
                                .setNegativeButton("Retry", null)
                                .create()
                                .show();
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }

        };

        LoginRequest loginRequest = new LoginRequest(email, password, responseListener);
        RequestQueue queue = Volley.newRequestQueue(LoginActivity.this);
        queue.add(loginRequest);
    }
});
<?php
$con = mysqli_connect("localhost","id1519330","****","id1519330");

    $email = $_POST["email"];
    $password = $_POST["password"];
  $statement = mysqli_prepare($con, "SELECT * FROM user WHERE email = ? and password = ? ");

    mysqli_stmt_bind_param($statement, "ss", $email,$password);
    mysqli_stmt_execute($statement);
    mysqli_stmt_store_result($statement);
    mysqli_stmt_bind_result($statement, $id, $name, $surname, $email, $password);

    $response = array();
    $response["success"] = false;   

 while(mysqli_stmt_fetch($statement)){

            $response["success"] = true;  
            $response["name"] = $name;
            $response["surname"] = $surname;
            $response["email"] = $email;
            $response["password"] = $password;

    }
    echo json_encode($response);
?>

*org.json.JSONException:Value您的响应似乎给出了一个HTML代码(当您的请求没有给出状态200时发生。使用调试器或打印响应来检查字符串响应,您将能够知道您的请求有什么问题。

可能是您的
响应
没有正确的json解析样式。请参阅
有关更多详细信息,请尝试调试以查看此
响应的值。添加一个弹出窗口或控制台println以确保密码和电子邮件是字符串而不是json对象。然后,您需要检查实际响应是什么,并打印出整个对象。您在某处解析了错误。错误提示:消息本身实际上应该告诉您解析的错误,但您没有包括全部内容,屏幕右侧有
相关的
部分。回答了大量相同的问题。