I'm a beginner in programming and I'm developing an android application that uses PHP and makes requests with Mysql. Initially I tested all the features on the local server to then migrate it to an online server, in this case, Hostinger.
One of my PHP files returns the value of an array correctly on the local server, however, when using the same PHP file on the online server with the same database, the array only responds as TRUE when I run echo
.
I tried doing the echo of each line and it works perfectly, just not being able to associate the values with the keys.
$resultado = array();
$ordenado = mysqli_query($connect, $ordenarExercicio);
while ($pacientes = $ordenado->fetch_assoc()){
echo $pacientes['grupo']; //imprime OK
echo $pacientes['nome_exercicio']; //imprime OK
echo $pacientes['utilizar_exercicio']; //imprime OK
$resultado[] = array("grupo" => $pacientes['grupo'],
"nome" => $pacientes['nome_exercicio'],
"habilitar" => $pacientes['utilizar_exercicio']
);
}
echo json_encode($resultado); //imprime TRUE