応答を読むと、常に PHP からエラー メッセージが表示されます: クエリにパラメーターがありません。PHP とクエリが 100% うまく動作することはわかっています。この方法でのみ発生します。
Volley.class
JSONObject params = new JSONObject();
params.put("consulta", "UPDATE Usuarios SET Nombre='AAA' WHERE IdUsuario=1");
//All right
RequestFuture<JSONObject> future = RequestFuture.newFuture();
JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST, URL", params, future, future); //request contains params with de sql sentence. Its well
VolleyS.getInstance(context).mRequestQueue.add(request);
JSONObject response = future.get(10, TimeUnit.SECONDS); //response contains the wrong error and the database isn't changed
if (response.getInt("success") == 0) correctoExterna = false;
else correctoExterna = true;
update.php
if (isset($_REQUEST['consulta'])){
$vConsulta= $_REQUEST['consulta'];
$result = mysql_query($vConsulta);
// mysqli_errno($db) != 0
if ($result)
{
$response["success"] = 1;
$response["message"] = "OK.";
echo json_encode($response);
myqli_commit($db);
mysqli_close($db);
}
else{
$response["success"] = 0;
$response["message"] = "ERROR :".mysqli_error($db);
echo json_encode($response);
mysqli_rollback($db);
mysqli_close($db);
}
}
else {
$response["success"] = 0;
$response["message"] = "ERROR, missing fields to insert";
echo json_encode($response);
mysqli_close($db);
}