I have the following query
$query="SELECT nombre,edad,genero FROM ...";
$result = sqlsrv_query($_conexion,$query) or die('Error en la consulta');
while($row = sqlsrv_fetch_array($result)) {
extract($row);
$mundos['data'][]=
array(
$nombre,
$edad,
$genero
);
}
print_r(json_encode($mundos));
However, nothing appears on the screen, if I put single quotes in the age and gender achievement data it appears as follows.
{"data":[["luis","$edad","$genero"],["maria","$edad","$genero"]
.. and so on.
The output format I require is the following:
{"data":[
['luis',"25","hombre"],
["maria","30","mujer"],
["karla","18","mujer"],
["pepe","35","hombre"]
]
}