0
私はまだこれが新しく、助けが必要です。たぶん私は見逃している何か..."org.json.JSONExceptionが発生しました:タイプjava.lang.Stringの値<brをJSONObjectに変換できません"
はここで...
最後に、これは私のボタンのアクティビティコードが..ですimport com.android.volley.Response;
import com.android.volley.toolbox.StringRequest;
import java.util.HashMap;
import java.util.Map;
public class OrderRequest extends StringRequest {
private static final String ORDER_REQUEST_URL = "http://10.0.2.2/customer/Insert.php";
private Map<String, String> params;
public OrderRequest(String order_name, String order_cust, String quantity, Response.Listener<String> listener){
super(Method.POST, ORDER_REQUEST_URL, listener, null);
params = new HashMap<>();
params.put ("order_name", order_name);
params.put ("order_cust", order_cust);
params.put ("quantity", quantity);
}
@Override
public Map<String, String> getParams() {
return params;
}
}
私のPHPコード
<?php
$con = mysqli_connect("localhost", "root", "", "customer");
$order_name = $_POST["order_name"];
$order_cust = $_POST["order_cust"];
$quantity = $_POST["quantity"];
$statement = mysqli_prepare($con, "INSERT INTO order (order_name, order_cust, quantity) VALUES (?, ?, ?)");
mysqli_stmt_bind_param($statement, "sss", $order_name, $order_cust, $quantity);
mysqli_stmt_execute($statement);
$response = array();
$response["success"] = true;
echo json_encode($response);
?>
だし、次にここに私の応答コードです
ここにLogCat
W/System.err: org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
私は、ヘルプpleaseeeを必要とする...あなたが要求している
PHPコードがJSONの代わりに
immibis