I'm new to php/mysql and have run into this problem.
My code works, but the $sqlResponse gives out an array. In the example below (the current response) I only want '117'.
"sortingId":{"@last_sortingId := MAX(sortingId)":"117"}
My code is:
$sqlResponseGet = mysqli_query($this->db, "SELECT @last_sortingId := MAX(sortingId) FROM items");
$sqlResponse = mysqli_fetch_assoc($sqlResponseGet);
$this->response($this->json(array('sortingId' => $sqlResponse)), 200);
I tried various things, like $sqlResponseResult = $sqlResponse[0] and The answer from this Single Value Mysqli
But can't get it to work
Really hope you can help me, thanks :)