I am having problems sending a JSON from a PHP and MySQL webService, I leave the code of the query and the fetch assoc, the query has already been checked and it is correct, in phpMyAdmin it makes me perfect, the problem is that when I receive the JSON on Android I receive things that should not be part of the JSON:
$consulta= "SELECT 'id','actividad','lugar','fecha' FROM 'planes' WHERE 'usuario'= '".$usuario."' ORDER BY 'id' DESC";
$result = mysqli_query($mysqli, $consulta);
$rawdata = array();
$i=0;
while($row = mysqli_fetch_array($result))
{
$rawdata[$i] = $row;
$i++;
}
echo json_encode($rawdata);
and this is what I get on android according to the log:
{"0": "1", "id": "1", "1": "Test", "activity": "Test", "2": "Madrid", "place": "Madrid "," 3 ":" 01/12/2019 "," date ":" 01/12/2019 "}
is putting things that are not, should be
{"id": "1", "activity": "Test", "place": "Madrid", "date": "01/12/2019"}
I do not know if it's the bars (/), if it's the utf8 encoding, ...
Any ideas?
Thank you very much, best regards