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
Recent Comments