I have this code snippet in PHP:
if (strcasecmp($_POST['method'], 'assignId') == 0) {
$username = $_POST['username'];
$response['code'] = 1;
$response['status'] = $api_response_code[$response['code']]['HTTP Response'];
$sql = "CALL new_person('$username')";
if (($result = $conn->query($sql)) === TRUE) {
$row = $result->fetch_assoc();
$response['data'] = $row;
}
deliver_response($response);
new_person
is a stored procedure which returns an id, it has been tested and works fine and deliver_response
returns json format of the input. It has also been tested and works fine.
Why do POST Requests return 404 error?
The stored procedure is being executed, but it doesnt return the result. FInally when I change POST method to GET and make a get request instead it works fine!
from Why does POST Request return 404
No comments:
Post a Comment