How can I echo empty array to frontend although the table doesn't have any records?
$result = mysqli_query($conn, "SELECT * FROM person");
while($res = mysqli_fetch_assoc($result)) {
$row = array(
'fname' => $res['fname']
);
$encoded[] = $row;
}
//$encoded ? echo json_encode($encoded); : echo array();