I hope you can help me I have the following problem:
I have the following code:
include '../php/conexionn.php'; #conexion a bd
header('Content-type: application/json; charset=utf-8');
$arrayAlumnos = array();
$busqueda="";
$busqueda=$MySQLiconn->query("SELECT * FROM alumnos");
$row_cnt = $busqueda->num_rows;
while ($res = mysqli_fetch_array($busqueda)) {
$arrayAlumnos[]=$res["nombre"];
}
$myJson=json_encode($arrayAlumnos);
echo $myJson;
the problem is in the localhost if it works perfectly, on the server where it hosts does not return anything, I have verified the connection and it is correct in fact verify that the query has results by printing the variable $ row_cnt, so that the problem I think that is when saving in the array.