I have used this same code before and it worked fine, but now that I have changed of host provider it doesn't. The connection is fine and fetching is correct. I've already checked line by line the code and everything seems to point that the problem is in the encode, but I can't figure out why.
$res=$cnx->query("SELECT U_ID, NAME FROM `USERS`;");
jsonData = array();
while ($array = $res -> fetch(PDO::FETCH_ASSOC))
{
$jsonData[] = $array;
}
echo json_encode(array('USERS' => $jsonData), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
It returns nothing, just a white line of nothing