So, does anyone knew there's limitation php to encode array using json_encode
?
I fetch from SQLServer using below code and it was succesful until the last 2 lines of json_encode
,
while($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC))
{
array_push($items, $row);
}
$result = array();
$result["data"] = $items;
echo count($items);
echo "<br/>";
echo count($result);
echo "<br/>";
echo count($result["data"]);
echo "<br/>";
header('Content-Type: application/json');
echo json_encode($result, 128);
I have search to the phpmanual, and although not mentioning anything about increased the memory, my settings at php.ini
is set to 2GB, so I am sure that's not the case.
When I count the array before encode, they return the rows just fine.
Thus, I did little test, increase the memory at php.ini and use SELECT TOP in the query, found out that it can return 6670 data rows using SELECT TOP (6670) *,
but ...
not one record show after I changed it to 6671 or just SELECT * which supposedly return about 13522 data rows, while I need them all?