Search Posts

PHP json_encode function not returning any objects if selecting more than 20 rows of data [duplicate]

This question already has an answer here:

include “connectdb.php”;

$data = array();
$query = "select * from customer";
$result = $dbhandle -> query($query);


if($result->num_rows > 0)
{
    while($row = $result -> fetch_assoc())
    {
        $data[] = $row;
    }
}

echo json_encode($data);

I have tried to limit to 20 rows and it works but when its more than 20 rows of data it does not return anything.

Source: Stackoverflow

Leave a Reply

Your email address will not be published. Required fields are marked *