使用Json / PHP从android接收JsonException错误

时间:2019-01-22 16:41:15

标签: php android json request android-volley

我正在使用凌空库将请求从android发送到服务器。 在发送我的请求后,如果是真的,我得到了json响应,否则我得到了这个错误:

org.json.JSONException : Value < br of type java.lang.string cannot be converted to JSONObject

这是我的php代码:

<?php

if($_SERVER['REQUEST_METHOD'] == 'POST'){

    $id = $_POST['id'];
	$email = $_POST['email'];
	$value = $_POST['value'];		
	$money = $_POST['money'];
	$payment_status = $_POST['status'];
	$description = $_POST['description'];
    require_once 'connect.php';
	
	
	function InsertPaymentsDetails(){
	    global $conn, $email, $value, $payment_status, $description;
        $statement = mysqli_prepare($conn, "INSERT INTO payments (email, value, description, status) VALUES (?, ?, ?, ?)");
        mysqli_stmt_bind_param($statement, "siss", $email, $value, $description, $payment_status);
        mysqli_stmt_execute($statement);
        mysqli_stmt_close($statement); 
	}
	if ($payment_status != "موفق"){
		InsertPaymentsDetails();
		$boolean = False;	
	} else {
		$finalvalue = $money + $value;
		$finalvalue = $money + $value;
		$sql = "UPDATE users SET money = '$finalvalue' WHERE id='$id' ";
		$boolean = True;
		InsertPaymentsDetails();
	}
	
	
}
	
    if(mysqli_query($conn, $sql) && $boolean === TRUE ) {
		
		$result["success"] = "1";
	 }

	else {
		$result["success"] = "0";
	}
	 echo json_encode($result);
     mysqli_close($conn)
		

?>

怎么了? 有人可以帮助我吗?

0 个答案:

没有答案