I have the follow code which doesn't print anything:
$array = array();
while ($res = $query->fetch_array(MYSQLI_ASSOC)) {
array_push($array, array(
'value' => $res['pregunta'],
'tokens' => explode(' ',$res['pregunta']),
'url' => $res['id-cadena']
));
}
echo json_encode($array);
But when I use print_r it works correctly:
Array ( [0] => Array ( [value] => ¿Cuál es la obra de Pablo Picasso basada en triangulos?
etc...
Have somebody had the same problem? Thanks a lot!