0
Hello, I have the following php code:
<?php
require("config_local.php"); //conexao com o banco de dados
$area = "eua";
$st = "ny";
$sql = $pdo->prepare("SELECT prop,old_no,emissao,area,country,e_name FROM table1 WHERE area = :area AND st= :st ");
$sql->bindValue(":area",$area,PDO::PARAM_STR);
$sql->bindValue(":st",$st,PDO::PARAM_STR);
$sql->execute();
$result = $sql->fetchAll();
$n = $sql->rowCount();
echo $n ; // mostra o numero correto
echo json_encode($result); // nao mostra nada, tela em branco
The problem is that when I try to execute this query, it returns me the blank screen, but if I take one of the fields to be shown, I receive the data correctly.
The question is, is there some kind of PHP limitation on showing large amounts of data/fields in JSON format? If yes, how could I dribble it? Because I need to show these and some other fields...
Thank you.
There seems to be nothing wrong with your code, try validating the return of the "json_encode" function if instead of a string, return the false Boolean, call json_last_error to know what the problem is. function documentation: http://php.net/manual/en/function.json-error.php
– Júlio Neto
No, the code works normally, the problem is that php seems to "limit" the amount of information to be shown. I’ve been testing the query by adding a field at a time, which comes to a point that when you add 1 more field, it stops displaying.
– Léo
I used jsonlasterror, I took the exception JSON_ERROR_UTF8, if you get something put here...
– Léo